Quote:
Originally Posted by Katsunami
!important and kobo_extra.css have nothing to do with one another with regard to being destructive or not. "!important" *is* destructive.
!important means: "Use these values, whatever comes after." A cascading stylesheet overwrites values of properties, so if you set "X" to 15 on an element, and then you set it to 20 on the same element (further down in the same stylesheet, or in one linked after the one that has "X" at 15), then the value will be 20. If you set "X" to "15 !important" however, the value will not be overwritten. The "!important" value will be the one used, independently of where it appears in the stylesheet. (Maybe it can be overwritten by a later defined, new "!important" on the same element; I don't know that.)
|
The fatal flaw with this argument is that this is what !important is *supposed* to do

. However, my comments are based on observed behaviour of what actual *did* happen on my Kobo devices 3 years ago. I tested the theory again today with a GloHD running fw 3.19.5761. The 'where-did-all-my-styles-go' problem in standard epubs when displayed on Kobo devices can still happen if the CSS contains !important. However, it's not 100% guaranteed to happen.
For example, the presence of the following rule doesn't trigger the problem
Code:
.small {
font-size: 0.75em !important;
display: inline
}
whereas simply reordering the rule does
Code:
.small {
display: inline;
font-size: 0.75em !important
}
I lack the patience to fully get to the bottom of it. Suffice to say getting rid of all occurrences of !important in all internal epub stylesheets cures the 'no styles' problem. This is good enough for me as anyone who understands CSS inheritance and cascading rules doesn't need it inside the epubs IMHO.