Internet Explorer 7上绝对定位的父级中的百分比宽度子元素 [英] Percentage width child element in absolutely positioned parent on Internet Explorer 7
本文介绍了Internet Explorer 7上绝对定位的父级中的百分比宽度子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个绝对定位 div
包含几个孩子,其中一个是相对定位 div
。当我对子 div
使用基于百分比的宽度时,它会在 Internet Explorer 7 ,但不能在Firefox或Safari上。
我使用像素宽度,它的工作原理。
- 这里有我遗漏的东西吗?
- 除了基于像素的宽度 ,在
上有没有简单的修复方法? - 包含此内容的CSS规范中是否包含此? 需要具有定义的
width
,以像素或百分比表示。在Internet Explorer 7中,父元素div
需要为子百分比定义width
可以正常工作。I have an absolutely positioned
div
containing several children, one of which is a relatively positioneddiv
. When I use a percentage-based width on the childdiv
, it collapses to '0' width on Internet Explorer 7, but not on Firefox or Safari.If I use pixel width, it works. If the parent is relatively positioned, the percentage width on the child works.
- Is there something I'm missing here?
- Is there an easy fix for this besides the pixel-based width on the child?
- Is there an area of the CSS specification that covers this?
解决方案The parent
div
needs to have a definedwidth
, either in pixels or as a percentage. In Internet Explorer 7, the parentdiv
needs a definedwidth
for child percentagediv
s to work correctly.这篇关于Internet Explorer 7上绝对定位的父级中的百分比宽度子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文