1. Basic CSS syntax: includes three aspects: selector, attribute, and attribute value.
Selector {property: property value ;}
Note:
1) attributes must be included in.
2) Use: To separate attributes and attribute values.
3) use; To differentiate multiple attributes.
4) when writing an attribute, spaces and line breaks among the attributes do not affect the display of the attribute.
5) an attribute has multiple attribute values. Each attribute value is separated by a space.
2. CSS call method:
There are three types: Inter-line calling (direct style definition in the element), internal calling (style definition in the page), and external calling (individually Writing Style files are called ).
3. Inter-line call:
<Element name style = "attribute: attribute value"> </element name>
4. Internal call:
<Style>
Selector {property: property value ;}
</Style>
The method varies according to the content.
1) <element name class = "class selector name"> </element name>
2) <element name id = "id selector name"> </element name>
5. External call:
1) use the link element to call
<Link rel = "stylesheet" href = "css file path" type = "text/css">
2) use @ improt to call
<Style type = "text/css"> @ import url (css file path) </style>
6. Apply CSS priority:
The Inter-line calls have the highest priority, followed by internal calls, and the lowest external calls.
1 2 3 <style>
4 div {
5 color: red;
6 background: green;
7}
8
9 span {
10 color: red;
11 background: green;
12}
13 </style>
14 15 <body>
16 <div style = "background: red; color: green;"> CSS priority </div>
17 <span> CSS priority </span>
18 </body>
19 7. DOCTYPE: the abbreviation of Document Type. The XHTML or HTML Version Used by the page.
8. DOCTYPE selection:
There are three types of DTD (Document Type Definition) in XHTML1.0, which are Transitional, Strict, and Frameset ).
1) transition DTD
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2) Strict DTD
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3) DTD of the framework
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Frameset // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">