Click here to Skip to main content
15,913,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want create one master page who have two or more CSS file So, question is can its possible to add two or more CSS file for a single master page and if it's YES then how can I do that?

How to associate those two file to that master page?
Posted

Yes, you can add multiple css files in master page.

In tag you have to add reference to the css file as follows :
HTML
<head>
   <link href="styles1.css" rel="stylesheet" type="text/css" /> 
   <link href="styles2.css" rel="stylesheet" type="text/css" />
</head>
 
Share this answer
 
Why won't you just add something like this to MasterPage markup?

<link type="text/css" href="<%=Page.ResolveClientUrl("~/css/Styles.css") %>" rel="Stylesheet" />


If you want to control css files from aspx Pages just add content Control:
XML
<head runat="server">
    <asp:ContentPlaceHolder runat="server" ID="pageHeadContent">
    </asp:ContentPlaceHolder>
</head>


and control this content place holder from page like this:

XML
<asp:Content ID="cwbHeadContent" ContentPlaceHolderID="pageHeadContent" runat="server">
    <link type="text/css" href="<%=Page.ResolveClientUrl("~/css/cwb.css") %>" rel="stylesheet" />
</asp:Content>


But remember to NOT place anything in that placeholder in MasterPage AND Page, cause content in MasterPage just disapper.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900