Quote:
Originally Posted by mattmc
One thing I did do, when I was working with iBooks and doing some fancy stuff with popovers, was I had to inline a bunch of styles onto the contents of the <aside> elements. Basically, iBooks was throwing out all the CSS that should have affected the contents of those elements.
|
You sure it wasn't just a specificity issue? The iBooks stylesheets throw a lot of stuff into universal selectors like this:
Code:
:root[__ibooks_internal_theme*="Night"] * { ... }
Which has the same precedence as
Code:
element.class element
or (0,0,1,2). If you define
Code:
element.class { ... }
then IIRC, it has lower specificity because it has the same number of classes, but fewer elements in the selector. Your inline style has specificity (1,0,0,0), which beats everything except !important (unless you used !important, in which case it beats everything previously declared).
Try this:
Code:
body element.class, element.class * { ... }
which gives you the same specificity as the built-in rules, and by virtue of being later, wins. (The universal selector in the second part is so that it applies to all elements inside. This overrides the universal selector for those. Do not include that for styles that set relative font sizes, obviously, or for box model stuff.)