Practical CSS tutorial: starting from Basics (2)

Source: Internet
Author: User

III. Format of stacked style sheets
In general, the declaration of a style sheet is divided into selector and block {} (block). The block contains properties and value. The basic format is as follows:
Selector {property: value}
Other formats 1:
1, 2, 3 {attribute 1: value 1; 2: value 2; 3: value 3}
Sometimes multiple delimiters use the same settings. To simplify the code, we can set styles for them at one time and separate them with commas.
When multiple attributes exist, they must be separated.
Other formats 2:
Selector 1 selector 2 {attribute 1: value 1; attribute 2: value 2; attribute 3: value 3}
It is very similar to format 1. It only adds "," to the selection operator, but the function is very different. It indicates that the set style rule takes effect only when both the content in character 2 is included in character 1.
IV. Classification of stacked style sheets
In order to make the webpage format not monotonous, the same selector must be able to be classified and different style designs can be performed according to different categories. The basic format is as follows:
Selector. Category name {attribute: value}
Category names can be referenced in HTML identifiers:
<Identifier class = Category name> webpage content
5. Pseudo-classes of stacked style sheets
In addition to the preceding classification methods, a pseudo-class concept is introduced to make the classification more flexible and diverse. What is the difference between a class and a pseudo class?
Generally, the selector can be set in the form of a bundle for multiple classes. Although multiple styles can be created for the same selector, however, the bundled form also limits the set class to be used by other selector. Pseudo classes are generated to solve this problem. Each pre-declared pseudo class can be referenced by all HTML identifiers, except for some block-level content settings. The basic format is as follows:
. Pseudo class name {attribute: value}
Pseudo classes can be referenced by any identifier in HTML.
<Identifier class = pseudo class name> webpage content

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.