【问题标题】:Where to add Link tags on a page that's got a master page?在有母版页的页面上在哪里添加链接标签?
【发布时间】:2010-10-29 13:34:30
【问题描述】:

当我在这里输入时:-

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">

<link href="Skins/SkinCustom/Editor.Default.css" rel="stylesheet" type="text/css" />

</asp:Content>

它说 Element Link 不能嵌套在 div 中...我应该如何链接我的 css 文件??

【问题讨论】:

    标签: c# asp.net css


    【解决方案1】:

    在你的主人的head标签中添加一个ContentPlaceHolder:

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

    然后在您的内容页面中:

    <asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
        <link href="Skins/SkinCustom/Editor.Default.css" rel="stylesheet" type="text/css" />
    </asp:Content>
    

    【讨论】:

    • 谢谢,@bla 我无法理解在 asp 页面上放置链接的位置。现在它就像魅力一样。
    【解决方案2】:

    如果您的母版页没有在 &lt;head&gt; 部分中提供内容占位符(编辑:并且您无法对其进行编辑),您可能不走运。

    查看母版页源代码并了解其他可用的内容占位符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-18
      • 2011-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多