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

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

From: Jenn Star <jenn@starfiend.com>
Date: Thu, 8 Aug 2002 17:18:59 -0400 (EDT)
To: Kynn Bartlett <kynn@idyllmtn.com>
cc: www-style@w3.org
Message-ID: <Pine.LNX.4.44L0.0208081652350.1529-100000@sailor.bunzy.net>

On Thu, 8 Aug 2002, Kynn Bartlett wrote:

> 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 can see how that implimpitation would be faster than doing <P
STYLE="color: red;"> for each para, but wouldn't it be even easier to just
apply ID's that were defined in the header to the Divs or paras?
if you want the styles defined in the specific element, the <element
style="....">
you/one could use the inherit value in the head style declaration to cut
down on the amount of <p style=""> tags neccessary

i do understand how that would be convienient for some, but what would
the difference really be between that and just the design aspect tags of
html?

jenn
> 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.
>
> --Kynn
>
> --
> Kynn Bartlett <kynn@idyllmtn.com>                 http://kynn.com
> Chief Technologist, Idyll Mountain            http://idyllmtn.com
> Next Book: Teach Yourself CSS in 24       http://cssin24hours.com
> Kynn on Web Accessibility ->>          http://kynn.com/+sitepoint
>
>
Received on Thursday, 8 August 2002 17:19:01 GMT

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