Ask the CSS Guy

I'm sick of googling for the IE7 CSS hack

So here it is:

*:first-child+html {}

But conditional comments are still better.

Comments (8)

Jeff L said:

That's more than is needed - this will work as well:

*+html { }


where the * = your doctype.

Brisbane Web Design said:

thanks for the post, very useful.

PostGinger said:

Useful posts, thanks!

Any chance you could expand on the "where * = your doctype"?

I've never seen a doctype selector in CSS or did I miss something?

CSS Guy said:

@PostGinger:

I don't think Jeff means you have to type out your doctype. Instead, the selector works if your html has a doctype specified. Leave it as a "*".

JD Graffam said:

the shorter * hack is very nice. I agree, not good for development but great for when you are in a hurry!

Nemanja Cosovic said:

Don't get it, I know for this:

* html body 'nameOfTheClassOrIdInQuestion'
{
somestuff: -10px;
meLovezMargins: 200px;
ect: none;
}

But where dose the IE7 understands what class or id he needs to "understand"?

Gaspar said:

I dont like to use, but sometimes i have to use it.

Whem a project is all wrong since the beginning i would not lose manny time in try to get a better way.

So i use this list of hack for all browsers...
http://www.solidstategroup.com/page/1592

Yash said:

Great info..Thank you
searching for such one

 

Post a comment