开发者

Position: absolute not respecting parent element in IE6

开发者 https://www.devze.com 2022-12-19 15:46 出处:网络
I have a page with a div in it. The div contains an image, is 700px wide and 300px tall. It is set to position: relative.

I have a page with a div in it.

The div contains an image, is 700px wide and 300px tall. It is set to position: relative.

To show some text to 开发者_StackOverflow社区the bottom of the DIV, I put a span into it and give it position: absolute; bottom: 8px

This works fine in all browsers, except IE6. IE6 puts the text to the very bottom of the page.

It is as if the parent element with its position: relative doesn' t even exist.

Is this known IE6 behaviour, or am I overlooking something?

I just checked, the HTML code passes W3C validation.


Did you set a height to your div? If there is no height set, IE6 considers this element as non existent.


I would say, use the

height:auto!important;
height:1px;

trick that will validate as well, and also give layout to IE6 which does not support the !important directive..

0

精彩评论

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