CSS Conditional Comments in SharePoint 2010


/ Published in: CSS
Save to your folder(s)

We discovered that conditional comments don’t always work so well in SP2010. Instead, it is necessary to use a SP control. Below is the correct syntax.


Copy this code and paste it in your HTML
  1. Use
  2.  
  3. <SharePoint:CSSRegistration Name="foo.css" ConditionalExpression="gte IE 7" runat="server" />
  4.  
  5. Instead of
  6.  
  7. <!--[if gte IE 7]>
  8. <link rel="stylesheet" type="text/css" href="foo.css"/>
  9. <![endif]-->
  10.  
  11.  
  12. The former will generate the latter when the page is rendered.

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.