可不可以在使用母版页的内容页里使用CSS
内容页里没有 <head> ... </head> 标签, <link rel= "stylesheet " type= "text/css " href= "web.css " /> 这段代码没地方写,难道不可以在内容页里使用CSS吗?
------解决方案--------------------好像只能直接写在母版页里吧。
------解决方案--------------------在母版页里面加.
<%@ Master Language= "C# " AutoEventWireup= "true " CodeFile= "AdminMain.master.cs " Inherits= "admin_AdminMain " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head runat= "server ">
<title> </title>
<link href= "../admin/Admin_Style.css " rel= "stylesheet " type= "text/css " />
</head>
------解决方案--------------------当然可以。
我的母板页里是这样,好使:
<%@ Master Language= "C# " AutoEventWireup= "true " CodeFile= "MasterPage.master.cs " Inherits= "MasterPage " %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " xml:lang= "en " >
<head id= "Head1 " runat= "server ">
<title> 无标题页 </title>
<link href= "CSS/Master.css " rel= "stylesheet " type= "text/css " />
<link href= "CSS/Main.css " rel= "stylesheet " type= "text/css " />
<link rel= "Bookmark " href= "images/favicon.ico "/>
<script type= "text/javascript " src= "JS/Citys.js " charset= "gb2312 "> </script>
</head>
<body>
------解决方案--------------------应该只可以在母版页里使用css连接..
------解决方案-------------------- <asp:literal id= "css " runat= "server " />
((Literal)this.Master.FindControl( "css ")).Text = string.Format( " <link rel=\ "stylesheet\ " type=\ "text/css\ " href=\ "{0}\ " /> ", css);
------解决方案--------------------顶!!
------解决方案-------------------- <asp:literal id= "css " runat= "server " />
((Literal)this.Master.FindControl( "css ")).Text = string.Format( " <link rel=\ "stylesheet\ " type=\ "text/css\ " href=\ "{0}\ " /> ", css);
原来还可以这么用啊 顶
------解决方案--------------------用CS代码控制生成的HTML比较规范。
感觉直接在内容页里引用CSS也可以。不过不规范。
------解决方案--------------------如果你是在 asp.net 里统一设计网站风格,使用 theme。
------解决方案--------------------用theme...
------解决方案-------------------- <head runat= "server ">
<title> 无标题页 </title>
<link rel= "stylesheet " type= "text/css " href= "default.css " />