gpt4 book ai didi

css - IE9 错误?显示 : table, 宽度:calc()

转载 作者:行者123 更新时间:2023-11-28 09:48:53 30 4
gpt4 key购买 nike

我对目前遇到的 IE9 特定问题感到非常困惑,想知道我是否做错了什么或者之前是否有人遇到过这个问题。

看来如果我使用 calc() + display: table; IE9 无法处理的元素?

我把它放在一个 JS Bin 里:http://jsbin.com/himuhume/1/

或者,复制步骤是:

HTML

<div class="container">
<div class="inside">
</div>
<span>Calc without display works</span>
</div>
<div class="container">
<div class="inside break">
</div>
<span>Calc display table does not</span>
</div>

CSS

body {
background-color: grey;
font-family: Arial;
font-size: 12px;
}

.container {
width: 100px;
height: 100px;
background-color: white;
margin: 50px;
}

.inside {
width: calc(90% + 10px);
height: 20px;
background-color: black;
}

.break {
display: table;
}

任何想法将不胜感激,欢呼:)

最佳答案

我确认该错误存在,IE9 不会在具有 display:table 的 DIV 上应用 calc() 宽度。可能的解决方法是:

  1. 在 display:table DIV 外部添加一个节点,对其应用 calc() 宽度并将 100% 宽度应用于 display:table DIV。
  2. float 内容而不是使用 display:table

关于css - IE9 错误?显示 : table, 宽度:calc(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22776279/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com