467,907 Members | 1,378 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,907 developers. It's quick & easy.

CSS element question

Hello CSS guru's:
I'm new to CSS and I'm having trouble deciphering markup like this:

#navcontainer ul { margin: 0; } or even this:

#navcontainer ul ul li { margin: 0; }

In the first example, the id #navcontainer is followed by whitespace and another CSS element. In the second example, there are 3 elements that follow the id, which are also separated by whitespace.

In the first example, I assume that the ul that is associated with #navcontainer will have a margin of 0.

But I have no idea what the second declaration means.

My question is, how are elements separated by whitespace in a declaration interpreted?

Any help would be appreciated.
Mar 6 '08 #1
  • viewed: 1085
Share:
2 Replies
Stang02GT
Expert 1GB
Hello CSS guru's:
I'm new to CSS and I'm having trouble deciphering markup like this:

#navcontainer ul { margin: 0; } or even this:

#navcontainer ul ul li { margin: 0; }

In the first example, the id #navcontainer is followed by whitespace and another CSS element. In the second example, there are 3 elements that follow the id, which are also separated by whitespace.

In the first example, I assume that the ul that is associated with #navcontainer will have a margin of 0.

But I have no idea what the second declaration means.

My question is, how are elements separated by whitespace in a declaration interpreted?

Any help would be appreciated.
kjmaclean,

Welcome to the Scripts! I point you to this site. It provides a lot of good information about CSS with examples and its in a step by step/ chapter like format. So can easily return to where you left off.

Hopefully that site will help you out. I know it helped me a great deal. Enjoy!
Mar 6 '08 #2
drhowarddrfine
Expert 4TB
#navcontainer ul ul li { margin: 0; }


Any help would be appreciated.
You are correct on the first one. The second can be read as "a <li> contained in a <ul> which is contained in a <ul> which is contained in #navcontainer". So the second <ul> is in a <li> of the first <ul>.
Mar 6 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Wole Ogunremi | last post: by
reply views Thread by magister | last post: by
4 posts views Thread by mab464 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.