Results 1 to 5 of 5

Thread: IE 8 conditional

  1. #1
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,126
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default IE 8 conditional

    I'm trying to put a conditional statement in for ie 8, 7, and 6 but it is not working currently. It doesn't read it at all regardless of the code inside. I'm assuming I'm doing it wrong. I only have 8 though so maybe it's just that they changed the conditional statment? This is the simplest version of my code. Also if the regular page has <style type="text/css">css stuff can i just put the conditional in the middle here?</style>or does it have to go outside here? Thanks.

    Code:
    <!--[if IE]>
    <style type="text/css">
    body {
    background:#00ff00;
    }
    </style>
    <![endif]-->
    Last edited by bluewalrus; 06-23-2009 at 05:16 AM.

  2. #2
    Join Date
    Jun 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It goes outside the <style></style> tags of your original style sheet

    Example:
    Code:
    <link rel="stylesheet" type="text/css" href="URL" />
    <!--[if IE]>
      <link rel="stylesheet" type="text/css" href="URL" />
    <![endif]-->
    Rando

  3. #3
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,126
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    That would be if I were using different style sheets though. Would it work like this...
    Code:
    <style type="text/css">
    * {
    margin:0;
    border:0;
    }
    #page_article {
    }
    #page_main {
    width:59.3em;
    background:#FFFFFF;
    margin:auto;
    }
    <!--[if IE]>
    #page_main {
    width:59.3em;
    background:#00FF00;
    margin:auto;
    }
    <![endif]-->
    </style>
    or this...
    Code:
    <style type="text/css">
    * {
    margin:0;
    border:0;
    }
    #page_article {
    }
    #page_main {
    width:59.3em;
    background:#FFFFFF;
    margin:auto;
    }
    </style>
    <!--[if IE]>
    <style type="text/css">
    #page_main {
    width:59.3em;
    background:#00FF00;
    margin:auto;
    }
    </style>
    <![endif]-->

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,875
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    You must use the second method. To distinguish between different IE versions, you can do things like:
    Code:
    <!--[if IE]>
    You are using Internet Explorer
    <![endif]-->
    
    <!--[if IE 5]>
    IE5
    <![endif]-->
    
    <!--[if IE 5.0]>
    IE5.0
    <![endif]-->
    
    <!--[if IE 5.5]>
    IE5.5
    <![endif]-->
    
    <!--[if IE 6]>
    IE6
    <![endif]-->
    
    <!--[if IE 7]>
    IE7
    <![endif]-->
    
    <!--[if IE 8]>
    IE8
    <![endif]-->
    
    <!--[if !IE]><!-->
    Not IE
    <!--<![endif]-->
    
    <!--[if IE 6]><!-->
    EITHER IE6 OR a non-IE
    <!--<![endif]-->
    
    <!--[if lt IE 7]>
    <![if gte IE 5.5]>
    IE>=5.5. and <7
    <![endif]>
    <![endif]-->
    etc.
    ===
    Arie Molendijk.
    Last edited by molendijk; 06-23-2009 at 08:39 AM.

  5. The Following User Says Thank You to molendijk For This Useful Post:

    bluewalrus (06-23-2009)

  6. #5
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,126
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    oo alright thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •