Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-20-2004, 07:55 PM   PM User | #1
ChocoboBop
New to the CF scene

 
Join Date: Sep 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
ChocoboBop is an unknown quantity at this point
The difference between...

I've been trying to study up on hovering css list navigations and I've been looking through several examples. On one of them I see:

Code:
	ul#mainMenu, ul  {
		padding:0;
		margin:0;
		list-style-type:none;
	}
	ul#mainMenu ul {
		margin-top:3px;
	}
What is the difference between the two styles? One has a , and the other doesn't, but they look the same to me. Couldn't the margin-top be added to the first one?
ChocoboBop is offline   Reply With Quote
Old 09-20-2004, 08:38 PM   PM User | #2
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
That comma makes all the difference in the world, the first one with the comma means the following CSS rules applies to all UL tags (the more specific selector prior to the comma is effectively ignored) while the second one without the comma means that it only applies to UL tags that are embedded within a UL tag that has an ID value of mainMenu.

See: http://www.w3.org/TR/CSS2/selector.html
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Old 09-20-2004, 09:11 PM   PM User | #3
gwendaal
Regular Coder

 
Join Date: Jul 2004
Location: France
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
gwendaal is an unknown quantity at this point
then is ot the same than

ul#mainMenu > ul {
margin-top:3px;
}
gwendaal is offline   Reply With Quote
Old 09-20-2004, 09:37 PM   PM User | #4
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
Replacing the space with a greater than takes it from applying to ANY UL tag which is a descendant of the UL tag with an ID of mainMenu to applying to only any UL tag which is a direct child. Effectively that's a useless rule because you've got to have a LI under a UL so you'll not be able to have another UL as a child of a UL.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Old 09-21-2004, 06:21 AM   PM User | #5
gwendaal
Regular Coder

 
Join Date: Jul 2004
Location: France
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
gwendaal is an unknown quantity at this point
thanks Roy !
gwendaal is offline   Reply With Quote
Old 09-21-2004, 03:38 PM   PM User | #6
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
I forgot to mention that a certain browser used by the vast majority of the users on the web right now doesn't honor the greater than selector anyway so there's another reason not to count on it's being usable right now.
__________________
Check out the Forum Search. It's the short path to getting great results from this forum.
Roy Sinclair is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:06 PM.


Advertisement
Log in to turn off these ads.