SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Jun 2009
    Location
    Norfolk - UK
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Inline CSS conditional comments

    .whatever {
    color: red; //all browsers well display red text
    *color: green; //IE 7 will display green text
    _color: blue; //IE 6 will display blue text
    }

    But how do I write inline css conditional statements to isolate IE8 or even all IE browsers.

    Thanks.
    Karl.

  2. #2
    SitePoint Zealot ok_hornet's Avatar
    Join Date
    May 2009
    Location
    Oklahoma
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Check out David Blooms inline IE8/7 hack.

    Even if it targets 8 & 7, you could do the stack like this so it targets the ie8/7 hack and then the 7 hack:
    Code:
    .whatever{
      color:red;               /* normal, all browsers */
      color /*\**/: orange\9   /* ie8 & 7 hack */
     *color: green;            /* target ie7 next */
     _color: blue;             /* target ie6 last */
    }
    Oh, and apparently, this will get you all IE versions, even IE8 in standards mode:
    Code:
    .test { color: blue\9; }  /* target all IE browsers */
    Be sure to check the comments on that site, people have found some other ways, too. I haven't tested many of them to see how they work, though.
    Follow me: @josh_max

  3. #3
    SitePoint Zealot ok_hornet's Avatar
    Join Date
    May 2009
    Location
    Oklahoma
    Posts
    110
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops, definitely check out the comments, there is some great stuff there about that hack as well as hacks targeting other browsers.
    Follow me: @josh_max

  4. #4
    SitePoint Addict
    Join Date
    Jun 2009
    Location
    Norfolk - UK
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ok_hornet View Post
    Oops, definitely check out the comments, there is some great stuff there about that hack as well as hacks targeting other browsers.
    Thanks Hornet...appreciated. I have searched high and low for that.
    Checking-out the link now.

    Regards, Karl.


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
  •