CSS Sub-selectors (vi)

Source: Internet
Author: User

One, sub-selector

The front and back parts of the child selector are separated by a greater-than sign, and the two-part selectors are structurally parent-child.

A child selector is a parent element that is specified according to the left-hand selector, and then looks under the parent element for a child element that matches the right-hand selector.

Second, a simple example
<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "><HTMLxmlns= "http://www.w3.org/1999/xhtml"><Head><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" /><title>Child Selector</title><Linktype= "Text/css"rel= "stylesheet"href= "Css/demo5.css"/></Head><Body><Div>  <P>It's a paragraph .<ahref="#">This is a hyper-connect</a>   </P></Div></Body></HTML>

@charset "Utf-8";/*CSS Document*//*set the style of the P element under Div*/div>p{font-size:14px;Color:#0000FF; }/*sets the style of the A element under the P element*/P>a{font-size:16px;Color:#FF0000;text-decoration:None;}/*The wrong spelling Div is not a parent-child relationship .*/Div>a{font-size:20px;Color:#FF0000;text-decoration:None;}

Child selectors are rarely used, and generally include choices that are not affected by parent-child relationships

The following wording contains selectors

Div a{    font-size:20px;    Color: #FFFF00;    Text-decoration:none;}

CSS Sub-selectors (vi)

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.