Wednesday, 18 September 2013

CSS: Confusion with selectors, div ~ h1 vs div > h1

CSS: Confusion with selectors, div ~ h1 vs div > h1

I am having a problem understanding the div ~ h1, it appears it selects
all h1 tags that directly follow a div.
But isn't this what div > h1 actually does ?
It selects all h1 that is a direct child of the div ?
I also came across div + h1 and at first i was confused, but this appears
to select only a single element i.e 1 H1 tag that follows a div.
Any ideas anyone has it would be really helpful.
Thanks

No comments:

Post a Comment