Sent by lon.kraemer on 29 July 2002 17:05
Hi Eric,
> At 10:32 -0500 7/28/02, lon.kraemer wrote:
>
> >Reading "Eric Meyer on CSS", I see descendant selectors such as:
> >tr td#crumbs
> >Since there can only be one id="crumbs", why not just:
> >#crumbs
>
> The basic reasons have come up elsewhere in the thread:
>
> * it's more precise in the sense of only styling 'td' elements
> with an 'id' of 'crumbs' when they're descended from a 'tr' element
> (which might not be the case in an XML document, for example)
> * it increases the specificity of the selector, making it more
> likely that it will be honored if other selectors happen to compete
> with it in some way
>
> The "hide from NN4.x" reason wasn't one I had in mind, actually, but
> I suppose it could be considered a positive side effect. (In some
> circumstances, anyway.)
> If I remember correctly (and it's been a few months since I wrote
> that text), I used the 'tr td#crumbs' selector mostly to show that it
> could be done, and to reinforce the idea of document structure and
> selectors having everything to do with each other.
> I didn't get into the subject of specificity in much detail
> because to do so could have required its own project, or else could
> easily have derailed whatever project I used to talk about it. On
> the other hand, this particular selector choice has already generated
> the same question in different forums, so maybe I should have said
> something about it in a sidebar note.
Thanks for the response and summary. As a matter of fact, I wrote Big
John offlist yesterday:
<blockquote>
I just called out to Eric since it was _his_
book I was citing. The more I think about it, the more I realize the
answer is going to have alot to do with "specificity" as you have
alluded to. Perhaps, though, it has to do with simply "illustrating" the
depth/flexibility of selector syntax.
</blockquote>
As I read your book, I may have other questions/observations. Is it
appropriate to cite those on this list, or should I go "offlist" to you
personally?
FWIW, I'm loving the book as I read. I feel CSS competent, but I'm
finding myself thinking "hmmm" every now and then as I read.
Thanks,
--
Lon Kraemer
-----------------------------------------