Sent by Matthias Gutfeldt on 14 January 2003 07:07
--- Luc [EMAIL-REMOVED]> wrote:
>
>
> Good morning Matthias,
>
> It was foretold that on 13-1-2003 @ 14:06:31 GMT-0800 (PST) (which
> was
> 23:06:31 where I live) Matthias Gutfeldt would mumble:
>
> <snipped a bit>
> MG> But you can test it for yourself: Add
> MG> a Doctype that triggers Standard mode, and see if that makes a
> MG> difference.
>
> That doesn't seem to make a difference, however i noticed the
> problem lays elsewhere: the person who did the layout used
> Dreamweaver and has put a size 4 on the p tag in the html:
> <p><font size="4" face="Arial, Helvetica, sans-serif"
>
> Now if i remove that size 4 the sheet kicks in. Because i never
> set the size in DW, i'm a bit unclear why removing it let the
> sheet kicks in.
Doh! That's a whole different story!
What happens here is the cascade, see
<http://www.w3.org/TR/CSS2/cascade.html#q12>.
The FONT attributes are translated into a stylesheet, probably
something close to this:
font {font-size: 1.2em; font-family: Arial, Helvetica, sans-serif;}
This font rule will kick in even if you have set a font-size for
other elements; the FONT rule will have more specificity.
If you work with other people's markup, it's generally a good idea to
clean the markup of all unwanted elements, e.g. DIV, SPAN, FONT, B,
I, anything you didn't want in there. In Dreamweaver this is quite
convenient, you can even do it for the whole site: CTRL+F, search for
specific tag, replace it with nothing. Or you can just search for
elements with "harmful" attributes.
Oh, and lay down the law with your co-HTML-coders: For each site,
write a Style Guide that clearly states what styles are to be used
for what, coding conventions (e.g. "Do not use FONT or any other
presentational HTML [list all evil elements here]. Use the following
CSS rules instead: [list all good css selectors, usually classes,
sometimes IDs]. If they don't know how to work with styles, show
them. It'll save you no end of trouble in the long run.
Matthias
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com