html - Why is my clearfix not working in Firefox? -
this site:
http://m2c.dreamhosters.com/wordpress/
the clearfix:
.clearfix:after, .sub-menu:after, .sub-menu:after li { content: ""; display: table; clear: both; }
works totally ok in chrome. in firefox doesn't show in element inspector (and makes parents div shrink.
how can fix problem?
as mentioned in comments, firefox dropping rule because .sub-menu:after li
in selector invalid. in css2.1 , selectors 3, 1 pseudo-element may appear @ per complex selector , must @ end of selector. when encountering invalid selector in ruleset browser must drop entire ruleset. why it's not showing in inspector.
to fix it, either remove offending selector, appears mistake:
.clearfix:after, .sub-menu:after { content: ""; display: table; clear: both; }
or if meant apply :after
pseudo-element .sub-menu li
, relocate pseudo-element so:
.clearfix:after, .sub-menu:after, .sub-menu li:after { content: ""; display: table; clear: both; }
so, instead of asking why css doesn't work on firefox, real question is: why chrome accept it? that's because webkit (and extension blink) known more lenient when comes parsing pseudo-elements, perhaps due fact employs non-standard features require actively violating spec. quote this other answer of mine:
perhaps root of problem lies in fact you're trying add generated content other pseudo-elements, again seems work in webkit browsers whatever bizarre reason. unlike above issue generated content within replaced elements, current selectors 3 spec , upcoming selectors 4 spec both clear on this: not supposed have more 1 pseudo-element per complex selector. of course, webkit has infamously flouted various rules when comes implementing pseudo-elements, in hindsight not surprise me see webkit mess doing so.
either way, real conclusion implementation of css generated content extremely poor beyond scope of current standard of css2.1 + selectors, mean generated content replaced elements such
input
,progress
, , nesting of pseudo-elements in single selector.
Comments
Post a Comment