jeffrey

i like butter, don’t you?

Browser CSS hacks

April 12th, 2007 · 8 Comments

Be warned, this post is for me, and for anyone who likes or dislikes workarounds for common CSS problems (i.e. you hate IE).

Display CSS in IE 7:

  1. *:first-child+html [class]
  2. {
  3. }

Display CSS in IE 7 and Firefox (not IE 6):

  1. html>body [class]
  2. {
  3. }

Display CSS in Firefox:

  1. html>/**/body [class]
  2. {
  3. }

I’m afraid I must declare myself a geek. I’m not that savvy, really.

Popularity: 27% [?]

Tags: code · css · illogic · jeffrey-ism

8 responses so far ↓

  • 1 Johnny-johnny // Apr 13, 2007 at 12:32 am

    The middle one actually works in IE6? I thought it couldn’t handle CSS2 selectors like ‘>’…

    Must go and test…

  • 2 Jeff // Apr 13, 2007 at 6:11 pm

    Yes! You are right… my apologies. I didn’t mean to cause confusion :) Must learn to proofread… I found a great reference for CSS hacks that validate but I lost the page. It wasn’t cached in my browser for some reason…

  • 3 Shannon // Apr 15, 2007 at 11:42 pm

    i feel like the dumb kid in the room.

  • 4 Eoghan // Apr 16, 2007 at 5:42 am

    Hey Jeff - I like to ignore IE!!
    When I can’t I use conditional comments like so:

    < !–-[if lt IE 7]-->

    [class] {
    }

    < --[endif]-->

  • 5 Jeff // Apr 16, 2007 at 1:58 pm

    I’ll fix it Eoghan :) That’s nifty as well. I found a great site with more conditional comments but I lost it. I need to find it again.

  • 6 Jeff // Apr 16, 2007 at 1:59 pm

    Shannon, don’t worry, this is geek speak. Remember me, freshman year, building a website for your class? This stuff relates to that! I’m guessing you don’t remember much about HTML and CSS? :)

  • 7 webweaver // Aug 22, 2007 at 5:45 am

    This is a great page for conditional comments - scroll down a bit. It gives you (amongst other things) every combination of IE browsers you could ever want to target with CCs. Very useful.

    Taming Your Multiple IE Standalones

    I never use anything *but* CCs for hacks now. They rock!

  • 8 Jeff // Aug 22, 2007 at 2:07 pm

    Excellent! Thanks… by the way, where was that package you can download and install the different IE browsers all at once? I can’t seem to find it :-o

Leave a Comment