SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I add a css that are located in root style library in a master page?

<SharePoint:CssRegistration ID="CssRegistration1" Name="<% $SPUrl:~Site/Style Library/awesome.css%>" runat="server" After="SharepointCssFile" />

Has to work beteween site collections...

Look at @atish answer.. also see this link cssregistration

share|improve this question
up vote 5 down vote accepted

You can use ~sitecollection instead of ~Site

<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/awesome.css %>" runat="server"  />

For html master page, it will be:

<!--SPM:<SharePoint:CssRegistration name="<% $SPUrl:~sitecollection/Style Library/awesome.css %>" runat="server"  />-->
share|improve this answer
Hmm that was the first thing I tried, probably a deploy that didnt go as expected. Thnx @atish – Plexus81 Feb 12 at 9:15
@Plexus81 I think your problem is "After="SharepointCssFile". – Christoffer Feb 12 at 9:17
It should work. I have used it in several projects. above code I just copy/paste. Check everything properly @Plexus81 – Atish Dipongkor Feb 12 at 9:19
@Plexus81 it could as well be a missing space and the end of .css "~Site/Style Library/awesome.css%>" But Atish answer about changing from site to sitecollection is the correct way to have it working for root sites as well as "Sub" site collections. – Christoffer Feb 12 at 9:24
@Plexus81 Of course you can, but should it not refer to a actual .CSS file? :)… – Christoffer Feb 12 at 9:27

Your Answer


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.