Hi - when I insert a <p> in a comparison <table>, then the font displays in smaller size and I can see in firebug that body p is influencing it, but I don’t know how to stop it.
If you scroll down to 2nd table where p’s are, you’ll see they’re now displaying correctly.
Do you or Paul have any idea why IE6 is displaying that huge white space above the txtbox on that page? I’ve checked carefully and all div’s are closed.
have you tried it/test it? it’s best you do before posting. usually, a simple look at the style cascade using dev tools UAs offer does more to understanding an issue than all the dry theory in the world.
That shouldn’t happen - .ari has a higher specificity than p so where you have text that is both inside a <p> and inside a <… class=“ari”>, it will use the ari class style rather than the paragraph style if there’s a clash.
[ot]Please could you use
tags to put round code, rather than [quote]s, it makes it easier for other people when trying to quote your message. Ta![/ot]
i guess you are confusing some about inheritance and specificity. yes, if ari was a value for the class attribute of a <p> element, .ari would have a higher specificity than p.
here’s an example to play with both inheritance and specificity:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en" dir="ltr"><head>
<style type="text/css">
body { size:100%; }
p { color: blue; font-size: 0.8em; }
.red { color:red; font-size:0.6em; }
.orange { color:orange; font-size:2em; }
</style>
</head><body>
<p>Paragraph. Blue text.</p>
<p class="red">Paragraph. Blue text. Red class.</p>
<hr>
<div class="orange">
Text node.
<p>Paragraph. Blue text. Orange container.</p>
<p class="red">Paragraph. Blue text. Red class. Orange Container. </p>
</div>
</body></html>
[LIST=1][*]If one declaration is from a style attribute, rather than a rule with a selector (an inline style), it has the highest specificity. If none of the declarations are inline, proceed to step two.
[*]Count the ID selectors. The declaration with the highest count has the highest specificity. If two or more have the same number of ID selectors, or they all have zero ID selectors, proceed to step three.
[*]Count the class selectors (for example, .test), attribute selectors (for example, [ type=“submit”]), and pseudo-classes (for example, :hover). The declaration with the highest total has the highest specificity. If two or more have the same total, or they all have totals of zero, proceed to step four.
[*]Count the element type selectors (for example div) and pseudo-elements (for example, :first-letter). The declaration with the highest total has the highest specificity.
[/LIST]
A single class selector has a higher specificity than a single element selector. I might be missing something blindingly obvious, but a class pretty much has to outrank an element, or the “.ari” format would be useless, because the element selector would override it, eg with <p class=“ari”>, anything you put in p {…} would override anything in .ari {…} - and that definitely doesn’t happen.
Of course, it would be a whole lot easier to de-bug if the site wasn’t such an eighteenth century mangle of inline formatting, unsemantic hooks and what looks like boilerplate template rubbish…
I tried that - defining the <p> not the table - and it doesn’t work. I wish I could just ignore IE6/7 but I’ve pandered to them on the entire site so it’d be nice to get them to display the font correctly in <table>s.
I agree that sometimes the automatic formatting can be a hindrance rather than a help … but if you use CODE rather than HTML/HIGHLIGHT then you can put whatever colours you like in there.[/ot]
Golly gosh and darn it, you’re right.
I’m so used to the problem being specificity that I completely forgot about declared styles outweighing inherited styles.
I’m an idiot.
Damn.
In your stylesheet, body p {...} affects all <p> elements inside <body>, whether they are contained in other elements like tables, or not.
But in your stylesheet you’ve got no mention of “body p”, so I don’t understand what Firebug is telling you. I’m also not sure what the problem actually is - what is misbehaving, and what do you want it to do?
(Closing the preceding <p> is good practice, but won’t actually have any effect. If you have a <p> open then any block-level tag will be treated as though it has a </p> in front of it)
Hi - I’m sorry, that still doesn’t work on that one table.
I realized I’m only keeping the data comparison <table>s. All my other tables (e.g. I had images in tables) I’m converting to div’s. This means 10pt Arial now applies to ALL tables. So I tried this:
It doesn’t make sense that it displays correctly in all docs, except in one table in one doc (and correctly in another table in that same doc!). Same for the white space at the top of that specs-exc.php. I checked that error page but nothing explains why only this page has white space above the txtbox. The errors mentioned are on every other page but they’re all displaying correctly.
Thanks for pointing out self-closing tags are not allowed in html. I didn’t know that. They’re there for the future when the pages get moved into wordpress So far it’s not caused a problem in any major browser.