Internet Explorer 7上绝对定位的父级中的百分比宽度子元素

编程入门 行业动态 更新时间:2024-10-26 12:27:04
本文介绍了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 positioned div. When I use a percentage-based width on the child div, it collapses to '0' width on InternetExplorer7, 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 defined width, either in pixels or as a percentage. In InternetExplorer7, the parent div needs a defined width for child percentage divs to work correctly.

    更多推荐

    Internet Explorer 7上绝对定位的父级中的百分比宽度子元素

    本文发布于:2023-10-07 23:42:21,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:百分比   宽度   元素   Internet   Explorer

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!