2015年6月22日 星期一

child selector

body > P { line-height: 1.3 }


up vote22down voteaccepted
it means that only "first nested" elements will be targeted ("child" elements), for example
   <div id="a">
       <div id="b">
         <div id="c">
       </div>
      </div>
    </div>
if you write
#a div{
 background: red;
}
then both #b and #c will be red, but if you use > like
#a > div{
 background: red;
}

沒有留言:

張貼留言