[SP Gotchas] Core.css Keeps Overriding My Styles!

If you use the CssRegistration and CssLink controls on a SharePoint page, core.css is always added to the HTML page last.  This means that any styles in core.css will override the styles you’ve defined in your custom stylesheets.  Does this make sense?! No.  But, like many other things in SharePoint, that’s the way it is.

A quick way to fix this is to just use a plain <link …> tag to include your stylesheets.  Since those aren’t processed server-side like links in the controls mentioned above, they will be loaded in the order you define in the HTML.

Heather Solomon has a blog post about this issue as well.

2 Comments

  • February 28, 2008 - 3:23 pm | Permalink

    I’m a little lazier (ok, a lot lazier). I just use the “Specify a CSS…” feature under Look and Feel > Master page–that always loads last.

    I reserve this technique for styling pages that refuse to be included in the above-mentioned feature, which includes a lot of the /_layouts pages.

  • February 28, 2008 - 4:56 pm | Permalink

    Yeah, that’s probably the best way to style the application pages. I’m not a huge fan of modifying the application.master.

    Incidentally, Have you gotten the application pages’ look-and-feel to match the regular master very well? I only saw it done once and the results weren’t all that great.

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    *

    You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>