2 replies [Last post]
scocla
Offline
newbie
Montreal, Canada
Last seen: 15 years 10 weeks ago
Montreal, Canada
Timezone: GMT-4
Joined: 2007-07-25
Posts: 2
Points: 0

Hello,
Here's the html code:

NOTE: the other 2 li contain the same div structure as the first but different content.
NOTE: because the code is generated by XSL I cannot simply close the menu div before the leftcolumn2 div starts. So I want to keep the same structure and only modify the CSS in order to reach the proper behavior:

As you can see leftcolumn2 div inherits the behavior of the menu div which is exactly what I DON'T want.

The best solution to my problem is to break the inheritance of the menu on leftcolumn2 and do not display any css within leftcolumn2 OR ignore the menu css code when you're in leftcolumn2 div and have a custom leftcolumn2 css code which is not influenced by menu OR overwrite the css code in leftcolumn2 in order to behave differently compared to menu div.
For instance in #menu ul li a {background: #fef; }, well I want .leftcolumn2 a {background: #f0f;} instead.

The reason for such a mix-up is because I like the fact that menu inposes its css on 'Parent IsVisible' div but not on the leftcolumn2 div.

Any ideas? :shrug:

Greatly appreciated,
Claudiu

Chris..S
Chris..S's picture
Offline
Moderator
Last seen: 10 years 2 weeks ago
Timezone: GMT+1
Joined: 2005-02-22
Posts: 6078
Points: 173

Your question isn't

Your question isn't particularly clear.

If you are worried about descendent styles applying to elements that shouldn't receive them, you need to write more explicit style rules for those elements to counter the first styles.

e.g.

#menu a { background: #fef; }
#menu .leftcolumn2 a { background: #f0f; }

or some other combination of style selectors and properties to achieve the same effect. Every style property has a default setting (e.g. float: none; display: static; font-weight: normal;). If you write a more specific style rule you can reset any property back to its default value.

scocla
Offline
newbie
Montreal, Canada
Last seen: 15 years 10 weeks ago
Montreal, Canada
Timezone: GMT-4
Joined: 2007-07-25
Posts: 2
Points: 0

Thanks

Sorry if my question wasn't clear, but you understood my problem and solved it!
Thank you,
Claudiu