开发者

Using CSS declaration of * {z-index:1;} to simplify all IE z-index issues

开发者 https://www.devze.com 2023-01-22 23:49 出处:网络
IE does funny things with z-index. When dealing with rollover navigation, I always went through the thought process of \"Ok. . . need to give this element position:relative, with this z-index, and the

IE does funny things with z-index. When dealing with rollover navigation, I always went through the thought process of "Ok. . . need to give this element position:relative, with this z-index, and the same to this one, then give this a higher z-index. . ." it always turned out to be a pain.

Then I thought, why not just give every element on the page a z-index of 1 to start, making it the same across all browsers? That way I only have to apply z-index:2 to my header and voila. I tried adding this to a couple of websites and saw no adverse effects.

I'm thinking 开发者_如何学CI will just add this to my typical reset stylesheet that I use on every project. Does anyone see a problem with this?

* {z-index:1;}


Every element by default has a z-index of zero, so I can't see how changing everything to one will help you.

Also using the * to run through every page element is very inefficient and will slow down your page.

0

精彩评论

暂无评论...
验证码 换一张
取 消