Last Updated: February 25, 2016
·
2.873K
· steveniseki

css plus and greater than

<b> The > sign is used for selecting the immediate child of an element </b>

In this example the 2 inner divs would be selected

css

.container > inner-2 {
}

html

<div class="container">
  <div class="inner-1"></div>
  <div class="inner-2"></div>
</div>

<b>The + sign is used for selecting an adjacent sibling element</b>

In this example the p with class second is selected

css

.first + .second { 
}

html

<div>
<p class="first"></p>
<p class="second"></p>
</div>

1 Response
Add your response

Wow thanks for this post

over 1 year ago ·