Blog

How to add Conditional Comments on SharePoint 2010

By Omar L.

Usually when we work on the .Net FronEnd, we just add this comment in our html.


<!--[if IE 7]>

        <link rel="stylesheet" type="text/css" href="sieena-ie7.css"/>

<![endif]-->

 

 

This does not work in MOSS 2010.

Solution.

We need to implement a CSS Registration (SharePoint Control) with a conditional expression in our Master Page.

This is the correct syntax.


<SharePoint:CSSRegistration Name="sieena-ie7.css" ConditionalExpression=" IE 7" runat="server" />


When the page is rendered, it is going to generate the following conditional comment.


<!--[if IE 7]>

        <link rel="stylesheet" type="text/css" href=" sieena-ie7.css"/>

<![endif]-->

 

 

With the following we will have access to our separate CSS, exclusively for Internet Explorer 7.

Thanks
.

 

Comments

On 09 Aug 2011 03:57, Acer Chrome Book said:

its very nice post great job and thanks for sharing.

Leave a comment

 
 
 
 
CAPTCHA Image Validation