tags:

views:

30

answers:

3

I assigned these classes menu second_menu menu_about_author to ul so the html code looks like <ul class="menu second_menu menu_about_author"> I wanted this ul to have the same properties like menu and second_menu and then I wanted to move the menu_about_author little bit down.

I did so by .menu_about_author { margin-top:40px; } but it didn't work

any idea why the margin-top:40px; is crossed? the link to the image is [1]: http://img153.imageshack.us/img153/882/58daeef0c3c846e4a8d6321.png

alt text

+2  A: 

use

.custom .menu.second_menu.menu_about_author { margin-top:40px; }

or

.custom .second_menu.menu_about_author { margin-top:40px; }

as selector

otherwise your margin is overwritten by the second_menu margin

probably also

.custom .menu_about_author { margin-top:40px; }

will work if this code is after .custom .second_menu

choise
great, great, great! I think you answered another of my questions :-) Thank you @choise could you recommend any css tutorial I am really confused how to `address` css elements
Radek
no, sry :( only german ones ;)
choise
ja, ich verstehe (is that correct?) not sure if I can remmember from high school
Radek
haha, wonderful :D
choise
Remember that multiple class selectors like `.class1.class2` don't work in IE6. Seems to me that 'menu_about_author' is addressing a specific menu, so would be better suited to an ID:.custom #menu_about_author.second_menu { margin-top:40px; }Which, I think, is better HTML style and gets around the IE6 problem as well. ID's have a higher specificity, too - which will solve your inheritance problem.
Beejamin
+1  A: 

Because .custom .second_menu has higher Specificity than .menu_about_author

In other words, .custom .second_menu is more specific than .menu_about_author, so it take priority.

You can learn about this here...

http://www.smashingmagazine.com/2010/04/07/css-specificity-and-inheritance/

You can solve the problem by doing something like this...

.custom .menu_about_author

or

.custom ul.menu_about_author

Other answers also have suggestions that will work by making your author entry more specific.

rikh
pity that I read your answer later than the other one. I love the way you explain this to me. Thank you soooooo much for the link. I do need some study. Thanks
Radek
+1  A: 

To quickly se if its an inheritance problem, you can use !important

.menu_about_author { margin-top:40px !important; }
Phliplip
@Phliplip: interesting. `!important` works too. So now the BIG question is what should I use to fix that? I have three right answers. Which one is the best or it doesn't matter?
Radek