By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,445 Members | 1,160 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,445 IT Pros & Developers. It's quick & easy.

CSS element question

P: 1
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
Share this Question
Share on Google+
2 Replies


Stang02GT
Expert 100+
P: 1,208
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 5K+
P: 7,435
#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.