Jonathan Greenberg
asked on
CSS: How To Affect A Div Class Within A Div ID
I have a div with a class attribute that appears several times on my page, but I want to affect only the first iteration with CSS. Each time it appears, it's inside a bunch of other divs. The one that I want to affect is within 8 divs, the top one of which has a unique ID. This is what the 8 divs look like in my XHTML:
<div id="top">
<div class="floatbox ie_fix_floats">
<div class="topblock width100 float-left">
<div class="mod-default">
<div class="module default">
<div class="module-2">
<div class="module-3">
<div class="module-4 deepest">
The div I want to affect is the bottom one, with div class 'module-4 deepest'. Eight levels of divs up is the div with the unique ID: 'top'.
Is there some way to write the css so as to effect only the div with class 'module-4 deepest' inside of the div with ID 'top'?
Thanks.
<div id="top">
<div class="floatbox ie_fix_floats">
<div class="topblock width100 float-left">
<div class="mod-default">
<div class="module default">
<div class="module-2">
<div class="module-3">
<div class="module-4 deepest">
The div I want to affect is the bottom one, with div class 'module-4 deepest'. Eight levels of divs up is the div with the unique ID: 'top'.
Is there some way to write the css so as to effect only the div with class 'module-4 deepest' inside of the div with ID 'top'?
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
lpxtech, I can't tell you how helpful your answer is! Thank you so much.
you could give 10 classes the module-4 class and style them 1 way and only give the last one the class="module-4 deepest" classes and style the deepest class as well.