gpt4 book ai didi

asp.net - MasterPage 和 ContentPage Body Css 问题?

转载 作者:太空宇宙 更新时间:2023-11-04 05:17:41 25 4
gpt4 key购买 nike

我有一个母版页,我有一个来自这个母版页的内容页。我必须只为这个内容页使用不同的 css 作为 body 标签吗?我该怎么做?

这是我的母版页的CSS

body, div, ul, ol, li, p, h1, h2, h3, span, pre, a, img, blockquote, table, tbody, tfoot, thead, tr, th, td, pre, code { 
margin:0px; padding:0px; border:0 none; outline:0; vertical-align:baseline;}

我不想为我的内容页面使用此 css 代码。我该怎么做?

最佳答案

您可以在包含 CSS 的母版页中创建一个控件。如:

<%@ Master Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server" >
<title>Master page title</title>
</head>
<asp:contentplaceholder id="CSS" runat="server">
<style type="text/css">
body, div, ul, ol, li, p, h1, h2, h3, span, pre, a, img, blockquote, table, tbody, tfoot, thead, tr, th, td, pre, code {
margin:0px; padding:0px; border:0 none; outline:0; vertical-align:baseline;}
</style>
<body>

</body>
</html>

然后您可以在客户端页面上放置一个内容控件来覆盖主页面,并在其余页面上省略内容控件(它们将继承默认值)。

我建议使用单独的 CSS 文件而不是直接嵌入它,但您也可以轻松完成。

关于asp.net - MasterPage 和 ContentPage Body Css 问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7502162/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com