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 created a master page and custom css file to brand the root site of on my SP10 server. I then applied this master page to all subsites. The style is applied properly on all sites except when I click the "All Site Content" link from one of the subsites. In this case, it still uses my master page but fails to apply the CSS.

The master page files links to the CSS with "../..Style Library/My.css" (as inserted by SPD). This normally resolves properly to "domain/Style Library/My.css" but from the "All Site Content" (and possibly other undiscovered pages) it is trying to load "domain/subsite/Style Library/My.css"

How can I fix this?

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

You can try using <SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/My.css %>" After="corev4.css" runat="server"/> to resolve a full path in the masterpage, though I have a funny feeling that might only work in Publishing Pages...

share|improve this answer
show 3 more comments

I have experienced this issue a few times and I always end up doing the same thing whenever the issue occurs to me. I simply put the CSS file in the layouts folder under 14 hive.

*Program files\Common files\Microsoft Shared\Web Server Extension\14\TEMPLATE\LAYOUTS*

From here all your sites, being root or sub, can reach it.

Both <SharePoint:CssRegistration name="/_layouts/My.css" After="corec4.css" runat="server"/> and <link rel="stylesheet" href="/_layouts/My.css" /> works this way.

Style Library works too, but can be tricky. If you use Style Library to store your CSS files, try putting %20 in between Style%20Library. Like so:

<SharePoint:CssRegistration name="$SPUrl:~sitecollection/Style%20Library/My.css" After="corec4.css" runat="server"/>
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.
{"cc_re__cc_re__cc_by_sa_3_0": ["        <li><a href=\"http://area51.stackexchange.com\" title=\"proposing new sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"http://careers.stackoverflow.com\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a> \r\n                with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.3.15.1463\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">SharePoint Stack Exchange works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>"], "copyright__copyright__copyright": [".\n\nStyle Library works too, but can be tricky. If you use Style Library to store your CSS files, try putting %20 in between Style%20Library. Like so:\n\n<SharePoint:CssRegistration name=\"$SPUrl:~sitecollection/Style%20Library/My.css\" After=\"corec4.css\" runat=\"server\"/>\nshare|improve this answer\nadd comment\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}