CSS sub-selector (6) and css Selector

Source: Internet
Author: User

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;}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.