Internet Explorer 7上绝对定位的父级中的百分比宽度子元素 [英] Percentage width child element in absolutely positioned parent on Internet Explorer 7

查看:91
本文介绍了Internet Explorer 7上绝对定位的父级中的百分比宽度子元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绝对定位 div 包含几个孩子,其中一个是相对定位 div 。当我对子 div 使用基于百分比的宽度时,它会在 Internet  Explorer  7 ,但不能在Firefox或Safari上。



我使用像素宽度,它的工作原理。


  1. 这里有我遗漏的东西吗?

  2. 除了基于像素的宽度 ,在
    上有没有简单的修复方法?

  3. 包含此内容的CSS规范中是否包含此? 需要具有定义的 width ,以像素或百分比表示。在Internet  Explorer 7中,父元素 div 需要为子百分比定义 width 可以正常工作。


    I have an absolutely positioned div containing several children, one of which is a relatively positioned div. When I use a percentage-based width on the child div, 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.

    1. Is there something I'm missing here?
    2. Is there an easy fix for this besides the pixel-based width on the child?
    3. Is there an area of the CSS specification that covers this?

    解决方案

    The parent div needs to have a defined width, either in pixels or as a percentage. In Internet Explorer 7, the parent div needs a defined width for child percentage divs to work correctly.

    这篇关于Internet Explorer 7上绝对定位的父级中的百分比宽度子元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆