With this HTML markup :
<html>
<body>
<ul class="tag-list">
<li class="tag"><div class="tag-label">short tag</div><div class="tag-tail tag-count">1154353</div></li><!--no whitespaces between list items!!--><li class="tag"><div class="tag-label">A quite long long long long long tag</div><div class="tag-tail tag-active">5</div></li>
</ul>
</body>
And this CSS rules :
.tag-list {
border:1px solid red;
}
.tag {
border:1px solid green;
display:inline-block;/*so that tags are lined up like words... */
margin-right: 0.5em;
margin-bottom: 0.5em;
white-space:nowrap; /* so that label & tail sub-divs are stuck all together */
height: 2em;
line-height: 2em; /* text is vertically centered */
}
.tag > div {
height: 100%;
display:inline-block; /*so that label&tail are lined up */
}
.tag-tail {
border:1px solid orange;
}
.tag-label {
border:1px solid blue;
overflow:hidden;
text-overflow:ellipsis;
max-width:10em; /* to generate a (text) overflow for the ellipsis*/
}
I get the expected result in Chrome 22.0.1229.94
But in Firefox 15.0.1, i get a weird result (div.tag-tail
elements are shifted down) !
You can compare the results in FF and Chrome with this jsFiddle.
I know that adding the property overflow:hidden;
to the selector/rule .tag-tail
fixes the issue, but i'd like to understand why this is needed for FF and why there is this difference in behaviors ?
Thank you for your answers !