4 Replies Latest reply on Jul 1, 2011 12:00 PM by Lelo Pieri

    Conditional CSS include

    Joseph Miller Newbie

      Hi,


      I'm wanting to wrap a CSS include in conditional HTML comments, i.e. I want my output to appear like:


      <!-[if lte IE 6]>
      <link href="/siteroot/path/styles/ie6-specific.css" rel="stylesheet" type="text/css" />
      <![endif]-->




      Currently in my template I have:



      &#x3c;!--[if lte IE 6]&#x3e;
      <a4j:loadStyle src="/styles/ie6-specific.css" />
      &#x3c;![endif]--&#x3e;



      However, the loadStyle tag ends up re-positioning the link tag in the head element where it sees fit, so I end up in the resultant HTML:



      <head>
        ...
        <link href="/siteroot/path/styles/ie6-specific.css" rel="stylesheet" type="text/css" />
        ...
        <!-[if lte IE 6]><![endif]-->
      </head>




      which, obviously, is no good :(


      So.. is there a way of wrapping the a4j:loadStyle with the correct markup? Or is there a way of getting the correct /siteroot/path/ so I can use an ordinary HTML <link> tag?