Brian:

Doesn't seem an easy task (I'm not a css master anyway), but I think you could use combinations of several selectors to accomplish what you want (not nesting it though).
Using descendent, child, adjacent and universal selectors,
(check http://www.websiteoptimization.com/speed/tweak/descendant/
and http://www.ddj.com/documents/s=2371/nam1011137554/index.html)
for instace, you could group rules like:


#navigation p + #tabs, *strong.someclass, div>a:hover {...}

You can define a rule in a group such as this even if you do not intend it to be applyed to all the ocorrences of the object in the html source, since if you define a more especific rule for that object later you will get the rule applyed to it.

You can check if a rule will actually be applyed to the object you intend to calculating its specificity and cascading order (http://www.w3.org/TR/REC-CSS2/cascade.html#cascading-order ,
and http://www.w3.org/TR/REC-CSS2/cascade.html#specificity).


You can also give more than one class to an html element, like:

<p id="desconhomepage" class="description place clear"></p>

You can use the "selectoracle" (http://penguin.theopalgroup.com/cgi-bin/css3explainer/selectoracle.py)
to check on exactly what your code means if you get doubts when the grouping starts getting too complex.


You may find a lot of information about selectors in this links list:
http://www.d.umn.edu/itss/support/Training/Online/webdesign/css.html

Of course you would have to deal with a poor browser support for some selectors.
Maybe a fat style sheet will be also (for the time being) a saffer one.


Isabel Santos


----- Original Message ----- From: "Brian Duchek" <[EMAIL PROTECTED]>



Is there a syntax in CSS declarations which 'wraps' classes/ids in a parent condition? I'm not asking this very clearly, but the idea is similar to the Javascript syntax...

with  {
...
}

The purpose being, I find myself writing a lot of statements like the below

#navigation p {...}
#navigation #tabs {...}
#navigation #tabs ul li a {...}

Isn't there an easier/more efficient way to apply the parent selector
#navigation to all the different groups?

#navigation {
p {...}
#tabs{...}
}

Does anyone know if the above works, or if it has any browser support holes?

I only ask because I know the people on this list can chew up this
question and spit it out like no one else :-)

Thanks,.....


******************************************************
The discussion list for  http://webstandardsgroup.org/

See http://webstandardsgroup.org/mail/guidelines.cfm
for some hints on posting to the list & getting help
******************************************************



Reply via email to