- From: Kynn Bartlett <kynn@idyllmtn.com>
- Date: Thu, 8 Aug 2002 13:27:24 -0700
- To: <www-style@w3.org>
At 1:08 PM -0700 8/8/02, Coises wrote: >I *think* you mean you'd like to be able to do something like this: > ><STYLE>P {color: red}</STYLE> > <P>Paragraph 1</P> > <P>Paragraph 2</P> ><STYLE>P {color: green}</STYLE> > <P>Paragraph 3</P> > <P>Paragraph 4</P> > >and have "Paragraph 1" and "Paragraph 2" in shown in red, while >"Paragraph 3" and "Paragraph 4" would appear in green. 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> 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 16:27:30 UTC