在具有母版页的页面上添加链接标记的位置?

时间:2010-10-29 05:11:37

标签: c# asp.net css

当我在这里输入时: -

<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文件?

2 个答案:

答案 0 :(得分:10)

在主人的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>

答案 1 :(得分:3)

如果您的母版页未在<head>部分(编辑:您无法编辑)中提供内容占位符,则可能会运气不佳。

查看母版页来源并查看其他内容占位符可用。