Selectors-Hierarchy

Selectors-Hierarchy


一、Child Selector (“parent > child”)

Under the specified parent element layer must be child elements.


    
    
    


    
 
 
       

aaa

   
   
        bbb    
   

二、Descendant Selector (“ancestor descendant”)

As long as the parent element is ancestor, regardless of the child element or the n-layer element is a sun descendant, are in line with selection criteria.


    
    
    


    
 
 
       

aaa bbbccc

   
   
        ddd    
   

三、Next Adjacent Selector (“prev + next”)

Select the elements and conditions are met prev next close to his brothers next element (note not a child element) of.


    
    
    


    
 
 

aaa

bbb
ccc

ddd

四、Next Siblings Selector (“prev ~ siblings”)

As long as the brother element is prev, and younger brother are optional elements are siblings to (can not close),

As long as the same class, and specify the name of the element can be selected to.


    


    
 
 

Paragraph 1 in the div.

Paragraph 2 in the div.

Paragraph 3. Not in a div.

Paragraph 4. Not in a div.

Please refer to point 5 CSS- fourth basic format selector (Selector) a.

Original: Big Box  Selectors-Hierarchy


Guess you like

Origin www.cnblogs.com/chinatrump/p/11514338.html