4
當您將輪廓元素和僞元素組合在一起時,Firefox的行爲與Chrome和Safari(我沒有測試過其他瀏覽器)的行爲不同。 有沒有辦法解決它或這是一個錯誤?帶有輪廓和僞元素的Firefox中的奇怪行爲
.main {
position: relative;
width: 100px;
height: 100px;
margin: 10px auto;
border: 2px solid #f00;
outline: 2px solid #00f;
}
.main:after {
content: 'Hello';
position: absolute;
width: 100px;
text-align: center;
bottom: -50px;
}
.wtf {
width: 400px;
margin: 90px auto;
}
<div class="main"></div>
<div class="wtf">
<p>In Chrome and Safari the 'Hello' is outside of the outline.</p>
<p>In firefox the outline is extended and the 'Hello' is inside the outline. Bug from Firefox or is there a way to fix this?</p>
</div>
演示:http://codepen.io/romainberger/pen/nuxlh
編輯: 測試在Firefox 20.0,鉻28和Safari 5.1
我沒有想過盒子影子,它很好用。我有點擔心瀏覽器支持,但它只是排除IE8,所以我會去「螺絲IE8」。謝謝! – romainberger 2013-04-25 12:42:28