tags:

views:

1624

answers:

1

~ is for the next sibling. Is there an equivalent for the previous sibling?

If there is not, a succinct no would suffice. :)

+7  A: 

Two things:

  1. There is no "previous sibling" selector; and
  2. ~ is for general sibling (meaning the elements share the same parent) and is a CSS3 selector. + is for next sibling and is CSS2.1.

See Adjacent sibling combinator from Selectors Level 3 and 5.7 Adjacent sibling selectors from Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification.

cletus