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.

 

8 Responses to Browser CSS hacks

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

    Must go and test…

  2. Jeff says:

    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 says:

    i feel like the dumb kid in the room.

  4. Eoghan says:

    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 says:

    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 says:

    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 says:

    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 says:

    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 Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>