【发布时间】:2012-12-17 01:29:01
【问题描述】:
我只是在阅读 Apache 的 css 设计模式,并且遇到块元素中溢出的内联元素的问题。这是链接
http://www.cssdesignpatterns.com/Chapter%2004%20-%20BOX%20MODELS/Inline%20Box/example.html
您可以看到带有“box”类的内联元素在 chrome 中保持在同一行框中,但在 firefox 中转到下一行,而所需的行为是 firefox 所做的。 谁能帮我解释一下为什么firefox和chrome有区别???
这里是html:
<div class="container">
<span class="default">BEFORE</span>
<span class="box">← Left ↑ Top
Bottom ↓ Right → </span>
<span class="default">AFTER</span>
</div>
这是css
.container {
border: 1px solid gray;
}
.default {
line-height: normal;
width: auto;
height: auto;
overflow: visible;
visibility: visible;
margin: 0;
padding: 0;
border: none;
background-color: gold;
}
.box {
line-height: 100px;
margin-left: 100px;
margin-right: 100px;
padding: 20px 120px;
border-left: 5px solid gray;
border-right: 5px solid black;
border-top: 5px solid gray;
border-bottom: 5px solid black;
background-color: gold;
overflow: scroll;
width: 99999px;
height: 99999px;
margin-top: 99999px;
margin-bottom: 99999px;
}
.default {
line-height: normal;
width: auto;
height: auto;
overflow: visible;
visibility: visible;
margin: 0;
padding: 0;
border: none;
background-color: gold;
}
这里是小提琴链接
【问题讨论】:
-
???你可以点击我发布的链接并在 google chrome 和 firefox.sorry 中检查元素,但我之前从未使用过 Fiddle
-
所以你希望每个内联元素都在自己的行中?
-
您好 webdeskil,很抱歉不理解 stackoverflow 中的规则。我发布了上面的代码。我只是想清楚为什么 chrome 和 firefox 在这种情况下会有所不同。我希望带箭头的 span 元素像 firefox 一样在 2 行中。非常感谢
标签: css