‘+’, ‘>’ and ‘~’ symbols in CSS Selector

‘>’  – Targets elements which are DIRECT children of a particular element.

div #container > p {
  border: 1pxsolidblack;






‘+’ – It is Adjacent sibling combinator. It combines two sequences of simple selectors having the same parent and the second one must come IMMEDIATELY after the first.

div + p { 
   color: green
‘~’  – It is general sibling combinator and similar to Adjacent sibling combinator. the difference is that the second selector does NOT have to immediately follow the first one means It will select all elements that is preceded by the former selector
div ~ p{

Leave a Reply

Your email address will not be published. Required fields are marked *

three + = 8

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>