Add a css file to only one page (ASP.NET main pages)

How to add a css file only to a child page when using the main ASP.NET pages, and then specify them in the main?

+6
source share
2 answers

You can point it to a child page inside the content as follows.

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <link href="Css/main.css" rel="stylesheet" type="text/css" /> 

the scope of this css will remain for this page only

+4
source

On the home page

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

On a specific page

 <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> <link href="~/pagecssfile.css" rel="stylesheet" type="text/css" /> </asp:Content> 
+10
source

Source: https://habr.com/ru/post/909983/


All Articles