W3C home > Mailing lists > Public > www-style@w3.org > August 2002

Re: Why is the style tag restricted to the head?

From: Bert Bos <bert@w3.org>
Date: Thu, 8 Aug 2002 16:54:36 +0200
Message-ID: <15698.34348.573471.261759@jfouffa.inria.fr>
To: "Joshua Prowse" <prowsej@fastmail.fm>
Cc: <www-style@w3.org>

Joshua Prowse writes:
> 
> What reason is there for restricting the style tag to the head of the document?
> Why not allow it anywhere in the document so that <style> tags that are placed
> lower override earlier ones?

It's more an HTML question than a CSS one...

It's a discussion that the HTML WG had many years ago, probably in
1996 or so. The reason is that allowing style elements to appear after
the elements they apply to presupposes a renderer that keeps the whole
document tree in memory. Many browsers do that at the moment (at least
more so than back in 1996), but I don't think we should *require*
browsers to work that way. E.g., if they do CSS but not Javascript
(such as an application that formats documents for printing), then
they don't need to keep elements in memory after they have been
rendered.

Style rules that come after the elements will also cause flickering,
when the style of already displayed elements changes. (That already
happens with external style sheets in some browsers, but that can't be
avoided.)



Bert
-- 
  Bert Bos                                ( W 3 C ) http://www.w3.org/
  http://www.w3.org/people/bos/                              W3C/INRIA
  bert@w3.org                             2004 Rt des Lucioles / BP 93
  +33 (0)4 92 38 76 92            06902 Sophia Antipolis Cedex, France
Received on Thursday, 8 August 2002 10:54:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:15 GMT