将css文件链接到内容页面

dan*_*ani 2 asp.net

我有母版页面和一些内容页面.
我想为每个内容页面分配不同的css文件.

(不使用主题)
我该怎么做?

Nil*_*ils 5

我通过在主页面中添加标题占位符并在内容页面中明确指定css来做到这一点.

在大师:

<head runat="server">
    <title></title>
    <link href="~/css/common.css" rel="stylesheet" type="text/css" />
    <!-- loads of other stuff / -->
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
Run Code Online (Sandbox Code Playgroud)

并在内容中:

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
        <link href="../css/SomeContent.css" rel="stylesheet" type="text/css" />
        <script src="../js/SomeJsToo.js" type="text/javascript"></script>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)