3

I'm using several custom stylsheets in my custom masterpage, but it's important in what order they are rendered. On the first one I use the After property like this:

<SharePoint:CssRegistration runat="server" ID="Custom1" Name="/_layouts/15/Custom1.css" After="corev15.css" />

But can I do this with my custom stylesheet as well? I want something along the lines of this:

<SharePoint:CssRegistration runat="server" ID="Custom2" Name="/_layouts/15/Custom2.css" After="Custom1.css" />

But just writing this doesn't seem to help, they get inserted in random order, sometimes the right order, sometimes not. Should I use a different path in "after" or is it not possible to do?

Grateful for answers!

  • 2
    Try adding the path, as you have done in Name also, in After. Or since you have the css files directly in the 15, remove the path from the Name property – Robert Lindgren Aug 7 '13 at 7:59
  • I'll add it an an answer :) – Robert Lindgren Aug 7 '13 at 8:02
5

Try adding the path, as you have done in Name also, in After. Or since you have the css files directly in the 15, remove the path from the Name property.

First option:

<SharePoint:CssRegistration runat="server" ID="Custom2" Name="/_layouts/15/Custom2.css" After="/_layouts/15/Custom1.css" />

Second option

<SharePoint:CssRegistration runat="server" ID="Custom2" Name="Custom2.css" After="Custom1.css" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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