Chapter 2 CSS application

Source: Internet
Author: User

This section describes the CSS application. Of course, we should first introduce how to create a Style sheet, including the declaration method and the method applied on the webpage, in the end, we will give you an overview of some CSS features. In summary, there are three methods to declare CSS:
I. Basic Declaration: The most typical CSS declaration method.
If element {property: value} is expressed in Chinese, that is
Component (tag) {property name: set value}
For example:
H3 {COLOR: BLUE} is a set of declarations.
II. Collective declaration: a group or array style rule (nature) that declares one or more components (tags) separated by commas) (rules of each group are separated by semicolons ).
Component (label ){
Property Name 1: Set to 1;
Property Name 2: Set to 2;
...}
Or
Component A (label A), Component B (label B), Component C (label C ),...{
Property Name 1: Set value 1;
Property Name 2: Set to 2;
...}
For example:
TD {
COLOR: BLUE;
Font-size: 9pt;
}
Or
TD, P, DIV {
COLOR: BLUE;
Font-size: 9pt;
}
III. Sub-item declaration: Group and declare multiple style rules separately.
Component A (label A) {property name 1: Set value 1; property name 2: Set value 2 ;}
Component A (label A) {property name 3: Set value 3; property name 4: set value 4 ;}
For example:
TD {COLOR: BLUE; font-size: 9pt}
TD {font-family: ""; line-height: 150%} does not conflict with each other because the declared nature is different. If you accidentally make repeated declarations for the same nature, only the set values that will be declared later will function.
Note that, in your declaration, your format will be accepted as long as it is correct, and the display results will not be affected whether it is case sensitive, blank, or line feed, you can write it according to your habits.
Method of application of C S
Next, we will introduce four basic methods for applying the created style sheet to the webpage.
1. Use the STYLE attribute: add the STYLE attribute to individual component labels.
<Component (label) STYLE = "property (attribute) 1: Set value 1; property (attribute) 2: Set value 2 ;...}
For example:
<Td style = "COLOR: BLUE; font-size: 9pt; font-family:" "; line-height: 150%> the advantage of this usage is that the style can be applied to various labels smartly, but the disadvantage is that there is no "uniformity" of the entire file 』.

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.