Grow your CSS skills. Land your dream job.

Adjacent sibling

Last updated on:

The adjacent sibling combinator in CSS isn't a selector on it's own, but a way of combining two selectors. For example:

p + p {
  margin: 0;

The plus sign (+) is the adjacent sibling combinator, between two paragraph tag (element) selectors. What this means is "select any paragraph tag that is directly after another paragraph tag (with nothing in between)". Here's some examples of what it would select:

  <p>I'm a paragraph</p>
  <p>I get selected!</p>

  <p>I'm a paragraph</p>
  <h2>Monkey hair</h2>
  <p>I will NOT get selected</p>

This is mostly useful for when using semantic markup and needing to adjust for certain scenarios in which elements are directly next to each other.

More Resources

Browser Support

Chrome Safari Firefox Opera IE Android iOS
Any Any Any Any 7+ ? ?


  1. Greated! Thanks for shared!

  2. Hey man thnx for porviding so much things but i need your help you disable comments under php chat i want ask you about php voice chat i want to make a chat room having voice chat along with it can you help me thnx alot :)
    i hope you will reply

Leave a Comment

Posting Code

  • Use Markdown, and it will escape the code for you, like `<div class="cool">`.
  • Use triple-backticks for blocks of code.
      <h1>multi-line block of code</h1>
      <span>be cool yo.</span>
  • Otherwise, escape your code, like <code>&lt;div class="cool"&gt;</code>. Markdown is just easier though.

Current ye@r *

*May or may not contain any actual "CSS" or "Tricks".