My markup contains a tree structure of same element that looks something like this:
<div class="node">
<div class="node">
<div class="node" />
</div>
<div class="node" />
</div>
What I would like to do is to alternate their background colors for each depth. I was able to achieve this by pretty ugly css and was wondering if there is a smarter way. Here is the naive solution
:
.a {
height: 10px;
background-color: red;
.a {
background-color: green;
.a {
background-color: red;
/* etc... */
}
}
}