I have the following markup presenting a nested documented structure.
Obviously the one CSS rules applies to div.title elements.
Assuming that the rule should never apply to the element div.title element
within the div.l2 element...how would I do that? I know about the '>'
selector and to introduce unique classes like 'title-l1', 'title-l2'...etc.
But the structure is pretty generic and more complex and I would like
to keep the CSS as flexible as possible...any idea?
<html>
<head>
<style type="text/css">
.l1 .title {
font-size: 30px;
color: blue;
}
</style>
</head>
<body>
<div class="l1">
<div class="title">title level 1</div>
<div class="l2">
<div class="title">title level 2</div>
</div>
<div class="l2">
<div class="title">title level 2</div>
</div>
</div>
</body>
</html>
Obviously the one CSS rules applies to div.title elements.
Assuming that the rule should never apply to the element div.title element
within the div.l2 element...how would I do that? I know about the '>'
selector and to introduce unique classes like 'title-l1', 'title-l2'...etc.
But the structure is pretty generic and more complex and I would like
to keep the CSS as flexible as possible...any idea?
<html>
<head>
<style type="text/css">
.l1 .title {
font-size: 30px;
color: blue;
}
</style>
</head>
<body>
<div class="l1">
<div class="title">title level 1</div>
<div class="l2">
<div class="title">title level 2</div>
</div>
<div class="l2">
<div class="title">title level 2</div>
</div>
</div>
</body>
</html>