-1

I'm trying to make some CSS as dynamic as possible, but for the next I'm having some issues making it work:

Say I have the following html and css so far:

nav.blended {
  color: red;
}
nav.blended + .optional-stuff {
  color: green;
}
<nav class="blended">
  <div class="substuff">
    should be green
  </div>
  <div class="optional-stuff">
    should be green
  </div>
</nav>

<nav class="blended">
  <div class="substuff">
    should be red
  </div>
</nav>

But now it always remains red.

codepen if needed: http://codepen.io/cskiwi/pen/GoRqPL?editors=110

cimmanon
  • 67,211
  • 17
  • 165
  • 171
Kiwi
  • 2,713
  • 7
  • 44
  • 82

1 Answers1

0

.optional-stuff is not siblings of nav.blended.

nav.blended {
  color: red;
}
nav.blended .substuff + .optional-stuff {
  color: green;
}
<nav class="blended">
  <div class="substuff">
    should be green
  </div>
  <div class="optional-stuff">
    should be green
  </div>
</nav>

<nav class="blended">
  <div class="substuff">
    should be red
  </div>
</nav>
Alex
  • 8,461
  • 6
  • 37
  • 49