On Thu, 19 Jul 2007, Julian Tulip's Licorice wrote:
> I understand descendant selectors:
> #main p {color: #fff;} - inside the 'main' div the <p> will be white.
Yes. (Or, more exactly, inside the element with id="main", _any_ <p>
element will have white text color.)
> But I see this sometimes:
>
> form#search {color: #fff;}
>
> The hash is right up against the form, and my understanding is the result is
> different than the former example? why is the space removed and what does
> this do?
The selector form#search means the <form> element that has the attribute
id="search". If it were form #search, it would mean the element that
occurs inside some <form> element and has id="search". Thus, the meaning
is quite different.
Since id attribute values shall be unique in a document, the selector
#search would suffice. The reason for writing form#search is partly a
matter of style (and it may look more descriptive when reading the CSS
source). Technically, it has higher specificity that #search, and this may
matter when several declarations apply to the same element.
--
Jukka "Yucca" Korpela, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7 information -- http://css-discuss.incutio.com/?page=IE7
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/