CSS selector and reference methods of various styles

Source: Internet
Author: User

CAscadingSTyleSHeets) defines how to display HTML elements.

 

1. The classification syntax structure of the selector:

 

1.1 Id selector 1.1.1 selector format

# Id: # + Element id; id is case sensitive.

1.1.2 example
{:;:;}
1.2 Class selector 1.2.1 selector format

: The Name Of The. + Class. The Class name is case sensitive.

1.2.2 example
{:;}
1.3 element (TAG) name selector 1.3.1 selector format

Element name: The element name is case-insensitive.

1.3.2 example
{:;}
1.4 compound selector 1.4.1 selector format

    ,, # Id,. ClassNameSemicolon (,).

1.4.2 example
{:;}
1.5 level selector 1.5.1 selector format

Parent Selector: Meets the sub-Selector condition under the parent selector..

1.5.2 example

① The parent selector is an element.

{:} 

② The parent selector can be a class, Id selector, or a child selector.

{:;}/* Indicates that when the table class is showInfo_tabel, the height attribute of the tr element below is 20px */
1.5.3 Image Display

 

2. Storage of CSS styles

Styles can be stored in 2.1 external style sheet 2.1.1 storage mode

It is stored in a special style table. A file suffixed with css.

2.1.2 Reference Method

Add the <link/> label to the

     
2.1.3 application scenarios

Multiple page sharing styles, such as the layout of Forum posts.

2.2 internal Sample Table 2.2.1 Storage Method

{:}
2.2.2 Use Cases

A style exclusive to a single page.

2.3 inline style 2.3.1 storage mode

Element.

2.3.2 application scenarios 

Special elements for special occasions.

 

3. Style priority

UnionMethod.

IntersectionWhich style attribute will be used according to the following conditions:

3.1 extraordinary reference

.

3.1.1 priority comparison

>

        

Multiple style selectorsContains this element.

>.

        

Show image:

 

Series of articles =================================================== ====

 

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.