css - Firefox :before position absolute incorrect -
this question has answer here:
[duplicate of firefox support position: relative on table elements?]
i have unordered list vertical rules between list-items:
html
<ul class="list-inner-border"> <li><span></span></li> <li><span></span></li> <li><span></span></li> </ul>
css
.list-inner-border { height: 100px; } .list-inner-border li { display: table-cell; position: relative; // not having causes misbehaviour width: 1%; } .list-inner-border li + li:before { background-color: red; content: ''; height: 80%; left: 0; margin-top: 5%; position: absolute; top: 0; width: 1px; } span { background-color: gray; display: block; height:90px; margin: 5px; }
the above works in browsers except firefox, behaves if container of position:absolute not have positioning of own (common oversight position:absolute):
chrome:
firefox:
in firefox, :before
s have jumped outside container , stacked vertically along edge of root element.
elements jacob proved me wrong here.position: absolute;
meant refer next parent position:absolute;
.
if assign 0 left
or top
, align root element. leave away , rules' positions correct in firefox.
because percentage based values differently calculated, might need absolute values there. make fallback firefox: targeting firefox css
sorry haven't found better
Comments
Post a Comment