CSS sub-selector (6) and css Selector
I. subselector
In the child selector, the front and back parts are separated by a greater sign, and the front and back parts are in the parent-child relationship.
The child selector is based on the parent element specified by the left-side selector, and then searches for the child element matching the right-side selector under the parent element.
Ii. Simple Example
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@ Charset "UTF-8";/* CSS Document * // * set the style of the p element under the div */div> p {font-size: 14px; color: # 0000FF ;} /* set the style of element a under Element p */p> a {font-size: 16px; color: # FF0000; text-decoration: none ;} /* When div and a are not in the parent-child relationship, they cannot be obtained */div> a {font-size: 20px; color: # FF0000; text-decoration: none ;}
The sub-selector is rarely used. Generally, the inclusion option is used to avoid parent-child relationship impact.
The following statement contains the selector:
div a{ font-size:20px; color:#FFFF00; text-decoration:none;}