[Original] Reading Notes in DIV + CSS business case and webpage layout Development (2)

Source: Internet
Author: User

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">
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.