1

I am just getting started with SharePoint Designer 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, I 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?

2 Answers 2

2

There are two ways. First, 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.

0
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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