Re: <style> in the <head> or in the <body> ?

Debbie Sinmao (debbie@periplum.cdinet.com)
Thu, 4 May 95 00:39:48 EDT

On Wed, 3 May 1995, H&kon W Lie wrote:

> On the part of style
> (just like META, KEYWORD and whatever), but on average it will be more
> compact than per-element definitions (or, per-element overrides in
> case you allow for the propagation of styles).
>
> Consider this:
>
> [example w/ style tag in head]
> size: 191 bytes
>
> Versus:
>
> [example w/ style elements for h1, h2, and h3 in body]
> size: 273 bytes

On 3 May, Dave Raggett wrote:

> Actually, the style notation reduces file size as compared to formatting tags
> The <FONT> tags are a case in point. Declaring that say H2's should be
> show in bigcaps once in the <STYLE> element saves endlessly repeating the
> same <FONT size="+3">...<FONT size="-3"> kind of thing. This holds up if
> when you subclass the H2's with a class attribute.
>
> The <STYLE> element saves space and allows efficient dynamic display!
> It also keeps your documents clean and easier to maintain.
>
> The other approach is to use <LINK>, so that there is nothing in <HEAD>
> with content, other than <TITLE>.
> i.e.
> <HEAD><TITLE>...</TITLE><LINK HREF="/foo.css" REL="style">
> <BODY>...

On 3 May, Dave Raggett also wrote:

> No - the idea was to keep to declarative style notations. The ability
> to place style info in the document head is for two reasons:
>
> a) low overheads for personalized style sheets for which caching
> efficiency would be low
>
> b) improve caching efficiency for external style info by allowing
> overrides to be included in document head, with standard stuff
> in generic external style sheet
>
> The parsing issues mentioned in previous postings are mistaken.
> With the style info in a single <STYLE> element in the document
> head, you parse the style info before you parse the document body
> and hence there is no delay or other impact on dynamic display.

ok, so by sticking style info in the head instead of the body, you get a
considerably smaller file size:

- that occupies less space on the drive
- that downloads faster for "efficient dynamic display"
- that is easier to maintain should one decide to revise the style
- caching efficiency
- no parsing problem---parsing of <style> is done before the body

are there any other pros to putting <style> in the head instead of in
the body? what about the cons?

is it possible to put multiple <style> in the head (as the placement of
stye info in the body gives one the capability to apply multiple styles
to the same document)? would/could this be done w/ class?

as for the use of <link> to a a stylesheet. this would involve an extra
net access. so, how could this idea be a good thing?

and as for those of you say that most people would have stylesheets in
their cache, so caching would be no problem. if lots of people were to
make use of stylesheets, and every time i view some document w/ my
browser and my browser saves that stylesheet in my cache, there'll be a
major overload in my cache---plus i clean my cache fairly regularly to
keep it from reaching some huge mb level.

(btw, i don't mean for this to be a diatribe stylesheets. au contraire.
i am very much looking forward to stylesheets and the opportunity to have
flexibility in the way i choose to present my documents on the web!)

debbie

p.s. if i sound ignorant, it's because i'm still new to (and yes i did check
the stylesheet info at w3---there's not much there (hint! :-) to w3) and
still learning about stylesheets (thanks hakon for being the "instigator"
:-) behind them!)