SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In regular old HTMl we are allowed to do the following to use a css file depending on browser versions:

<link rel="stylesheet" href="path-to-styles/css/cssfilename.css">
<!--[if IE 7]>
<link rel="stylesheet" href="path-to-styles/css/cssfilename.css">

in a sharepoint user control we can add the files like so:

 <SharePoint:CssRegistration name="/_layouts/solutionfolder/filename.css" After="corev4.css" runat="server"/> 

How can I determine which version of the style sheet to load based on browser version? Or do I register them all then later determine which to use

share|improve this question
up vote 2 down vote accepted

You can use ConditionalExpression property to specify your conditional browser version.

For ex.

<SharePoint:CSSRegistration name="/_layouts/solutionfolder/filename.css" After="corev4.css" ConditionalExpression="lt IE 7" runat="server" />
share|improve this answer

Your Answer


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.