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

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

> 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 <>       
> Chief Technologist, Idyll Mountain  
> Next Book: Teach Yourself CSS in 24
> Kynn on Web Accessibility ->>

Received on Thursday, 8 August 2002 17:19:01 UTC