On 14 Jun 2005, at 9:40 am, Robert Neville wrote:

Can you add descendant ID selectors to an ID selector?

#container #header, #container #footer

Yes.
But it is not often needed: an ID selector is always unique on a page anyway.

Would a better approach be the ID selector with the
class selector?

#container .header, #container .footer
Not better, not worse than the previous one.
The difference with the previous one is, you can use a class selector multiple times on a page.
Then you can have
#box1 .emphasisedText {font-weight:bold; color:lime;}
#box2 .emphasisedText {font-weight:normal; color:yellow}

<div id="box1"><p class="emphasisedText">I'm lime coloured and bold weighted</p></div> <div id="box2"><p class="emphasisedText">I'm yellow coloured and normal weighted</p></div>


In my scenario, the header div is not a direct
descendant of the container div. My HTML uses a table
structure for lowest common denominator render
engines.  The whole project is experimental. A code
snippet follows below. Let me know if you could
confirm various methods for declaring descendant
selectors.

Doesn't matter how deeply nested the descendant is, it is always a descendant of it's parent.
#container table tr td div#header p, #container table
tr td div#footer p

You only add more specificity with those selectors
#parent #child  vs #parent table #child
the second one would only select something when the #child is a descendent of a table that is a descendent of #parent.


Philippe
---
Philippe Wittenbergh
<http://emps.l-c-n.com/>

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to