I am making an aspx page and need to link some css pages. From the root of the site collection the css pages are located in Style Library/CSS/files_here.css

My aspx page is located at SitePages/Page.aspx

<SharePoint:CSSRegistration ID="CSSReg5" name="Style Library/CSS/styles.css" After="corev4.css" runat="server"/>

The line I'm using above does not work, what is my flaw in my CSSReg? Before we moved this page to another site collection using a similar structure we had it working correctly.

1 Answer 1



<SharePoint:CSSRegistration ID="CSSReg5" name="<%$SPUrl:~SiteCollection/Style Library/CSS/styles.css%>" After="corev4.css" runat="server"/>

the part <%$SPUrl:~SiteCollection points to the root site collection, maybe your code is not pointing to that location! rather the site or sub site, method above explicitly says root site collection is the css file location!

  • This worked perfectly, thank you so much I was trying something very similar to this before but didn't have the syntax locked down. Thanks again!
    – cm2
    Commented Jul 21, 2014 at 23:20
  • no problem happy to help!
    – Ali Jafer
    Commented Jul 21, 2014 at 23:31

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.