• home
  • about
  • contact
  • showcase

The Adjacent Sibling (+) Selector

January 01, 2020

Adjacent sibling combinator

The adjacent sibling combinator (+) separates two selectors and matches the second element only if it immediately follows the first element, and both are children of the same parent element.

/* Paragraphs that come immediately after any image */
img + p {
  font-style: bold;
}

Fine Use for the Adjacent Sibling (“+”) Selector


Tai Lu ( 呂台生 )

Posted by Tai Lu ( 呂台生 ) who's building useful things.You should follow him on Twitter

  • ← Styled Button with Ripple Effect
  • Five Steps to add Netlify Functions to Gatsby →
© 2020, Built with Gatsby

copyright © 2020 taislu