Thursday, 15 September 2011

html - What is the difference beetween "div>p" and "div p" in CSS -



html - What is the difference beetween "div>p" and "div p" in CSS -

this question has reply here:

css selectors ul li {…} vs ul > li > {…} 5 answers

div>p selects <p> elements parent <div> element , div p selects <p> elements within <div> elements. w3schools says dont know difference. if element within 1 kid , other parent. dont see differences.

example:

<div> <span> <p>...</p> <span> </div>

div > p won't select paragraph, div p will. in other words, first selector parent-child, while sec ancestor-descendant.

html css

No comments:

Post a Comment