Re: style declarations

by "Lois Wakeman" <lois(at)lois.co.uk>

 Date:  Mon, 28 Jan 2002 09:55:30 -0000
 To:  <hwg-techniques(at)mail.hwg.org>,
<cbirds(at)earthlink.net>
  todo: View Thread, Original
>In the headers as a <.style><./style> tag
        <<<< - yes
>Inline as ???
        <<<<<<< as a style attribute containing the style rules
>As a separate file <.a href="stylesheet.???">Link<./a>
        <<<<< no - as a <.link rel="stylesheet" href= ......     in the head

(See W3C. org for a full description.)

To summarise more clearly, three ways of calling styles:

1 a call in the head to a separate css file (plain text with the style rules
in it) - equivalent to a Word document using the styles in a template. This
file has just the rules, no script tags or anything.

2. rules in the head section inside a script block, equivalent to setting
new styles in a Word doc but not the template

3 explicit style attributes on an element in the page. Equivalent to setting
paragraph formatting without using a style. Needs nothing in the head at
all.

1 and 2 require a class attribute on the elements in the body that are to
use the style, specified in the stylesheet or head respectively.

3 overrides 2 and 2 overrides 1 - which is the "cascade" in CSS. 1 overrides
the browser's default style sheet.

IMO, 1 is the tidiest as it enforces consistency across pages and is easy to
update. 2 or 3 might be useful to override in a single page, but I don't use
it unless I have to because the client wants it - it is very easy to forget
to update the page style. Also, NS4.n has problems with the cascade
(surprise, surprise) , so a mixture of methods is best avoided if you have
users with this browser.

Lois Wakeman
------------------------------------------------------
http://lois.co.uk
http://siteusability.com
------------------------------------------------------

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA