After reading W3C documentation on CSS3 selectors, I am still a little bit confused, what is the difference between E F and E ~ F selectors.
E F an F element descendant of an E element
E ~ F an F element preceded by an E element
In my opinion they are absolutely the same.
selects an Element
Fwhich is a child (descendant) ofE. So you have a nested structure, whereEis the parent (ancestor) ofF.this is similar to
E > Fwhich will only match ifFis a direct child ofE(no other elements in between).While
selects an Element
Fwhich is preceded by an elementE. In this case, you have a non-nested structure andEandFare Siblings.which again is similar to
E + Fexcept that here,Fmust followEdirectly (with no other Element in between).