http://frontended.blogspot.com/search/label/html

Search

2014年8月19日 星期二

Child and Sibling Selectors

Child Selectors
*CSS from the previous code example will apply only to the first <div> element that has a class of box. The second <div> element with a class of box is inside another <div> element. As a result, the styles will not apply to that element, even though it too has a class of box.

Adjacent Sibling Selectors
*The styles will apply only to the second, third, and fifth paragraphs in this section of HTML.

General Sibling Selectors
*The styles will apply to the first three paragraph elements. The last paragraph element is not a sibling of the <h2> element because it sits inside the <div> element.
Back to Top
Powered by ProofFactor - Social Proof Notifications