2.2 CSS3 basic Syntax + Selector

Source: Internet
Author: User

1. Basic syntax

Selector1, selector2{

property1:value1;

Property2:value2;

}

If value is greater than 1 words (such as font-family may be sans serif), quotation marks (font-family: "sans serif") are required

2. Advanced syntax

Inheritance effect

3. Deriving selectors

Define a style based on the context of the element location

 <! DOCTYPE html> en   > <meta charset="  utf-8   > <title></title> <link rel= " stylesheet  "  Type= " text/css  "  Href= " mycss.css  "  >
// derived selection labels are separated from outer to inside with spaces p strong{    color:aqua;}

4. ID Selector

Specify a style for the element labeled ID, in # to define

 <! DOCTYPE html> en   > <meta charset="  utf-8   > <title></title> <link rel= " stylesheet  "  Type= " text/css  "  Href= " mycss.css  "  >  " > <strong> derivation selection </strong> </p></body>
// The ID selector is represented by the #, and the context location is the derived selector, both with #pid strong{    Color:aqua;}

4. Class Selector

Use. To express

<! DOCTYPE Html>"en"> <meta charset="UTF-8"> <title></title> <link rel="stylesheet"Type="Text/css"href="Mycss.css">class="Pclass"> <strong> derivative selection </strong> </p></body>
// class selection and derivation selection in conjunction with . Pclass strong{    Color:aqua;}

5. Property Selector

  

2.2 CSS3 Basic syntax + selector

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.