1. Home
  2. Css
  3. Select next sibling

Select only the next sibling of a given type.

#css#selector
<style>
    .first-element + .next-element{ border: 1px solid }
</style>

<span class="first-element">Item</span>
<span class="next-element">Item</span> <!--  this gets selected  -->
<span class="next-element">Item</span> <!--  this does not  -->
Output:

Item Item Item

copy
Full Css cheatsheet