Quote:
Originally Posted by Doitsu
AFAIK, you can have multiple classes, and as long as they don't contradict each other, nothing unexpected happens. However, if they do contradict each other the style last defined in the stylesheet wins, which might lead to unexpected results.
I've created a simple test file with two html files that contain exactly the same code and two stylesheets with exactly the same styles. The only difference is that in the second stylesheet the first style was moved to the end of the stylesheet.
HTML code
Code:
<body>
<h3>Chapter 1</h3>
<div class="first third">
<p class="third first">It was a dark and stormy night.</p>
<p class="first second">And so it began...</p>
<p>The End.</p>
</div>
</body>
page 1 style
Code:
.first {
text-align: left;
color: green;
font-weight: bold;
font-family: sans-serif;
font-size: 1.5em;
}
.second {
text-align: right;
color: blue;
font-family: monospace;
font-style: oblique;
font-size: 1em;
}
.third {
color: red;
font-variant: small-caps;
text-align: center;
}
page 2 style
Code:
.second {
text-align: right;
color: blue;
font-family: monospace;
font-style: oblique;
font-size: 1em;
}
.third {
color: red;
font-variant: small-caps;
text-align: center;
}
.first {
text-align: left;
color: green;
font-weight: bold;
font-family: sans-serif;
font-size: 1.5em;
}
As you can see, rearranging the styles makes a difference.
|
Doits:
How'd you build that mobi? I mean, I see an azw3 file. Did you build that with Calibre or KG?
Vis-a-vis multiple classes: if memory serves, yes, we use them, but I think it's a matter of, KG is so "fragile," and the end-results so irrationally unpredictable at KDP, that we tend to stick to "simpler," in terms of coding, because if you have anything even slightly out of line, you either get the inverse of what you're expecting or as you say, unpredictable results.
I am not really sure why there's a problem with stating the class for each p, however. Sure, it would be nice to just do a div dec, and not have to style the p classes therein, but other things don't carry over p tags, so...why would fonts?
And, yes, sure, order *would* matter, when no other method of determining precedence, for inheritance, is specified--wouldn't you think?
Hitch