WordPress.org

Ready to get started?Download WordPress

Forums

WP2.3 IE Conditional Style Sheet (5 posts)

  1. irishmark
    Member
    Posted 6 years ago #

    SO i want to introduce a conditional stylesheet on a site i am developing for my cousin. I have my regular stylesheet and i have an IE specific one called ie-style.css.

    My understanding of the required code is:
    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="ie_style.css" />
    <![endif]-->

    HOWEVER! I am not sure where in my header i am supposed to put this when the style sheet is not called in the same way. It seems the stylesheet is called within the style parameters of the header:

    <style type="text/css" media="screen">
    @import url( <?php bloginfo('stylesheet_url'); ?> );
    </style>

    Does anyone know how to combine these two great bits of code.

  2. irishmark
    Member
    Posted 6 years ago #

    ok, i just figured it out! It's amazing what a good night's sleep does for you!

    After the original style tags you need to place the conditional tags around the same statment with a full URL to the alternate stryle sheet:

    <style type="text/css" media="screen">
    @import url( <?php bloginfo('stylesheet_url'); ?> );
    </style>

    <!--[if IE]>
    <style type="text/css">
    @import "http://www.irishmark.frih.net/wordpress/wp-content/themes/RedGrundgeAshley/ie_style.css";
    </style>
    <![endif]-->

  3. irishmark
    Member
    Posted 6 years ago #

    ok so no this doesnt work - anyone got a clue?

  4. toky
    Member
    Posted 6 years ago #

    actually as you suggested works for me, giving the complete path to the alternative css and placing it just after the </head> tag.
    Thanks!

  5. aar0on
    Member
    Posted 5 years ago #

    Hey, this worked perfectly and solved a problem I was having with IE!

    The one thing I changed was

    <!--[if IE]>

    to

    <!--[if lt IE 8]>

    I found IE8 Beta 1 displays the page perfectly, so if any version of IE below v8 is used (lt = less than), it'll grab my alternate style sheet.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags