When it comes to combining outline and pseudo-elements, Firefox has a unique behavior compared to Chrome and Safari (I haven't tested other browsers). Is this a bug or is there a way to resolve it?
.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' appears outside of the outline.</p>
<p>However, in Firefox, the outline extends and the 'Hello' is inside it. Is this a bug in Firefox or can it be fixed somehow?</p>
</div>
Demo: http://codepen.io/romainberger/pen/nuxlh
Edit: Tested on Firefox 20.0, Chrome 28, and Safari 5.1