Difference Between These Selectors
Is there any difference between these selectors? div.demo and div .demo div#demo and div #demo Does it select the same element? div.demo{some code} div .demo{some code}
Solution 1:
Yes, there is.
div.demo will match a div with class demo
<div class="demo">
div .demo will anything with class demo inside any div:
<div><spanclass="demo"></div>Same with the id selector #.
Solution 2:
div.demowill select div with class demo whereas
div.demowill select any descendant of a div with class demo. Same concept for the second case.
Post a Comment for "Difference Between These Selectors"