tags:

views:

1071

answers:

3

Hi Guys,

Normally when we are using Master/Content style pages, we apply the css to Master page so every page child of the master page can use the style but I don't want this,I want I wanna apply css to content page directly instead of master page. Where should I put

<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />

that reference code ?

Thanks in advance by the way.

+3  A: 

Put a content placeholder in the head portion of your master page. Not all content pages will need to place anything in it but this particular content page can place the CSS file you want to link.

Spencer Ruport
+6  A: 

Normally I put a content placeholder in the head section of the master page. That way any content page can add extra css/js/etc references to the head of the page.

In your master page put the following

<head>
  ... title, meta tags, js and css links ...
  <asp:contentPlaceholder id="head" runat="server" />
</head>

Then in your pages you can include extra elements in the head using this

<asp:content contentplaceholderid="head" runat="server">
 <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
</asp:content>
Steve Temple
Could you elaborate it a little bit more and show me a sample please ?
Braveyard
Have added a sample for you
Steve Temple
thanks, It looks great and clear now.
Braveyard
A: 

You can't apply a style sheet to a content page only, it applies to the whole web page.

Guffa
Well It seems I can do :)
Braveyard
@atarikg: No, you can't. The browser has no concept of content pages, it couldn't limit the scope of the css to a content page even if it wanted to.
Guffa