Question

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!

Was it helpful?

Solution

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" />
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top