Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am just getting started with SPD 2010/Foundation 2010 and having trouble applying a CSS file.

On the home site I am using a custom master page that uses this code to load a stylesheet to override the SP styles

<SharePoint:CssRegistration name="/Style Library/OVERRIDE.css" After="COREV4.css" runat="server"/>

Can I reference this stylesheet from within a subsite and if so, how?

In the subsite, I have tried creating a Style Library folder and putting a copy of OVERRIDE.css there, but that didn't work. Also tried using an absolute URL to the css file in the name attribute but that didn't work either

<SharePoint:CssRegistration name="http://xx.xxx.xxx.xxx/Style%20Library/OVERRIDE.css" After="COREV4.css" runat="server"/>

What am I doing wrong?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

There are two ways. Fist way is you can use the same declaration of css as in your root web (the same file).

<SharePoint:CssRegistration name="/Style Library/OVERRIDE.css" After="COREV4.css" runat="server"/>

You should not create your style library in a subsite (you add reference to the root).

The second way is to put your css in the _Layouts folder.

See this thread to understand difference between this ways.

share|improve this answer
    
Thanks for the answer! –  James Mason Aug 16 '12 at 21:53
add comment

If you created a custom master page and referenced your CSS it should apply to all subsites as long as the same master page is applied. Your code is ok and should work in the site collection.

There should only be 1 style library, don'T create another in the subsite. Leave your CSS where it is and make sure the master page being used is the one referencing your CSS.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.