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

H&kon W Lie (howcome@w3.org)
Thu, 4 May 95 06:11:47 EDT

Debbie Sinmao writes:

> 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?

There are two types of HEAD elements: STYLE and LINK. You have a good
collection of pro's, but not all arguments are valid for both. One con
is that many current browsers will display the content of unknown
HEAD elements.

> 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?

Possible, yes. But it creates problems with regard to scope,
inheritance etc. Class is a better way to achive the same effect.

> 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?

It would only require an extra net access the first time. Like any gif
icon today. After, it could be cached.

> 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.

What if we come up with some standard styles that people could refer
to, e.g. 50 world-wide? These could easily be cached and one could do
minor personal modifications in the <STYLE> tag.

> 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

What do you miss? a beginners guide? a faq?

Cheers,

-h&kon

Hakon W Lie, WWW project CERN, CH-1211 Geneva 23
http://www.w3.org/hypertext/WWW/People/howcome/