Previous Message
Next Message

Basic confusion on syntax

Sent by Els on 8 March 2006 06:06


Scott Haneda wrote:
> I don't even know how to search this one out, excuse the basic
> question:
>
> #subNavlist li

> ul#subNavlist

> Can someone explain to me the difference in putting the html
> part you want before the css name, versus after:
> ul.myname
> myame.ul

No, that last one is incurrect.

> Its not at all making sense to me, I would think I would want
> to do li#subNavlist but that does not work.

The id or class is always *after* the elements name, as in 
ul#subNavlist, or you can use it *without* the element's name, as 
in #subNavlist.
When you see an element's name after an id or class, as in 
'#subNavlist li', there is a space between them, and it means the 
second element is a child of the first one.

Some examples:
'ul#subNavlist li' means a <li> element, that is a child of a 
<ul> element with id="subNavlist".
'#subNavlist li' means a <li> element, that is a child of any 
element with id="subNavlist".
'ul#subNavlist' means a <ul> element with id="subNavlist".
'div.foo' means a <div> element with class="foo".
'.foo' means any element with class="foo".
'.foo div' means a <div> element which is a child of any element 
with class="foo".

If you're ever in doubt what a certain string of classes, 
elements and or id's means, paste it into the Selectoracle for 
clarification:
http://gallery.theopalgroup.com/selectoracle/

HTH

-- 
Els
http://locusmeus.com/
http://locusoptimus.com/

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
IE7b2 testing hub -- 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/
Previous Message
Next Message

Message thread: