Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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">
<![endif]-->

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
add comment

1 Answer 1

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
add comment

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.