Selector Collective declaration and nesting

Source: Internet
Author: User

1. Selector Collective statement

H1,h2,h3 {color:}

No matter what kind of selector, only the public CSS code, can use this collective declaration to streamline the code. The following code is streamlined:

{font-size: 12px; background: 0230}      {font-size: 12px; width: 500px }      . Blue{font-size: 12px;  Color: #0900}      . H1{font-size: 12px;  Font-weight: normal}

After streamlining

#header, Div,.blue,.h1 {font-size: 12px}        {background: 0230} {width: 500px}.              Blue{color: #0900}      . H1{font-weight: normal}

2. The selector is nested. If an ID is in the P tag in Div, the A font is shown in red, as shown below:

<style>      #div p a{color:red}  </style>  <body>  <div id= "div" >      <p><a> links </a></p>  </div>

Doing so eliminates the need to set a selector for a individually

Excerpt from: Kwoojan's "2 Days driving Div+css"

Selector Collective declaration and nesting

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.