Quote:
Originally Posted by Turtle91
I was just testing this in Sigil...I don't know if it's a QT bug or not but it didn't seem to work as expected. I had the following CSS/HTML:
div.fluff p {text-align:justify; font-style:italic}
p.att {text-align:right; font-style:normal}
<div class="fluff">
<p>Stuff, stuff, and more stuff.</p>
<p>Stuff, stuff, and more stuff.</p>
<p>Stuff, stuff, and more stuff.</p>
<p class="att">Should be normal and right aligned</p>
<p>Stuff, stuff, and more stuff.</p>
<p>Stuff, stuff, and more stuff.</p>
<p>Stuff, stuff, and more stuff.</p>
<p class="att">Should be normal and right aligned</p>
</div>
Neither the right align of the font style normal were applied in the "att" class unless I used the !important tag in the "att" declaration.
Anyone seen this before?
|
Aha! I have it. Your problem is the selector specificity. See 6.4.3
here:
Quote:
A selector's specificity is calculated as follows:
count 1 if the declaration is from is a 'style' attribute rather than a rule with a selector, 0 otherwise (= a) (In HTML, values of an element's "style" attribute are style sheet rules. These rules have no selectors, so a=1, b=0, c=0, and d=0.)
count the number of ID attributes in the selector (= b)
count the number of other attributes and pseudo-classes in the selector (= c)
count the number of element names and pseudo-elements in the selector (= d)
|
for both, a=0 and b=0
but for div.fluff p, c=1 d=3
for p.att, c=1, d=2
so div.fluff p overrides p.att, unless you make it important (which you should probably not do.)