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'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!

share|improve this question
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
    
Worked like a charm, thank you Robert =) –  stinaq Aug 7 '13 at 8:02
    
I'll add it an an answer :) –  Robert Lindgren Aug 7 '13 at 8:02

1 Answer 1

up vote 5 down vote accepted

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" />
share|improve this answer

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.