View Single Post
Old 08-01-2015, 03:48 PM   #28
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by mattmc View Post
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.)

Last edited by dgatwood; 08-01-2015 at 03:51 PM.
dgatwood is offline   Reply With Quote