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

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

From: shawn allen <shawn@alterior.net>
Date: Thu, 8 Aug 2002 14:07:26 -0700
To: www-style@w3.org
Message-ID: <20020808140726.H873@gryphon>

quoth Kynn Bartlett:
> I don't know what Joshua wanted, but I'd like to be able to do something
> like this:
> 
> <div>
>    <style type="text/css"> p { color: red; } </style>
>    <p>paragraph 1</p>
>    <p>paragraph 2</p>
> </div>
> <div>
>    <style type="text/css"> p { color: green; } </style>
>    <p>paragraph 3</p>
>    <p>paragraph 4</p>
> </div>

I see no reason why classes wouldn't suffice for this example. 

> This satisfies your statement in which you say:
> At 1:08 PM -0700 8/8/02, Coises wrote:
> >The biggest problem with this is that it breaks the normal paradigm of
> >"nesting" within HTML: information is carried "inward" to containing
> >blocks, not "downward" to following blocks, in HTML.
> 
> The example I gave above does not break this paradigm; instead, it
> relies on it.  In this case, the first style element would set up a
> rule which applies only within the context of the containing block,
> that is to say, the first div element.  The same goes for the second.
> 
> Why would you want to do this?  Because that way you can take any part
> of the document and have specific styles that apply to it.  You can
> yank out the second <div> and have it "work correctly" when you paste
> it into another document, but you can't do that with style tags in the
> head of the page.

It's [arguably] just as easy to yank that bit of HTML out of one
document, throw it into another, then do the same with the applicable
rules in the new document's stylesheet (embedded or otherwise). I agree,
the addition of a document flow style element would really make things
"easier", but that seems to go against the holy grail of separation that
we're aiming towards.

IMO, this opens the door to the style element being used merely as a
standards-"compliant" replacement for font, still keeping documents
difficult to maintain and polluting structure with meaningless markup.

-- 
shawn allen
  e: shawn@alterior.net
  p: 415 577 3961
  im: shawnpallen
Received on Thursday, 8 August 2002 17:08:16 GMT

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