css样式表从内容页 [英] css style sheet from content page

查看:214
本文介绍了css样式表从内容页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个内容页面,其中有一个指向样式表的链接,我希望该页面是特定的样式表单,也就是说,我希望该设计在加载时特定于该页面,并在

我的内容页:

 < asp :Content ID =Content1ContentPlaceHolderID =headrunat =server> 
< link href =〜/ Styles / StyleSheet1.css =stylesheettype =text / css/>
< / asp:Content>

在我的主页:

 < asp:ContentPlaceHolder ID =headrunat =server> 
< / asp:ContentPlaceHolder>

我的样式表〜/ Styles / StyleSheet1.css只是例如给这个id我的内容页。

  #defualt_tbl 
{
background-color:Gray;
}

< table id =defualt_tbl>

表不会变成灰色,当我在主页中点击viewsource链接存在于头部。

 < link href =〜/ Styles / StyleSheet1.css =stylesheettype =text / css/> 


解决方案

找到了!



但我相信你的答案也一样。

 < asp:Content ID =Content1 ContentPlaceHolderID =headrunat =server> 
< link href ='<%= ResolveClientUrl(〜/ Styles / StyleSheet1.css)%>'rel =stylesheettype =text / css/>
< / asp:Content>


iv'e got a content page with a link to a style sheet which i want to be specific for that page , i.e. i want the design to be specific for that page when it loads and takes its place in the contentplaceholder on the main page.

IN MY CONTENT PAGE :

  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">  
      <link href="~/Styles/StyleSheet1.css" rel="stylesheet" type="text/css" />
  </asp:Content>

IN MY MAIN PAGE :

   <asp:ContentPlaceHolder ID="head" runat="server">       
   </asp:ContentPlaceHolder>  

MY STYLE SHEET ~/Styles/StyleSheet1.css just for example ill give this id to some table in my content page.

       #defualt_tbl
       {
          background-color:Gray;
       }

       <table id="defualt_tbl">

the table does not become gray , when i click viewsource in the master page the link is present in the head section.

        <link href="~/Styles/StyleSheet1.css" rel="stylesheet" type="text/css" />

解决方案

found it !

but i belive your answers work as well .

  <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
     <link href='<%= ResolveClientUrl("~/Styles/StyleSheet1.css") %>' rel="stylesheet"    type="text/css" />
  </asp:Content>

这篇关于css样式表从内容页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆