CSS + DIV: getting started with CSS

Source: Internet
Author: User

CSS design: Chapter 2

  • XHTMLAnd HTMLImportant differences

1. Mark the name in XHTML in lower case

2. In XHTML, the attribute name must be in lowercase.

3. the tags in XHTML must be strictly nested.

4. Mark in XHTML as closed

5. In XHTML, even the tags of empty elements must be closed.

6. In XHTML, attribute values are enclosed in double quotation marks.

7. In XHTML, the attribute value must be in the complete form.

8. In XHTML, we should distinguish between "content tag" and "structure tag"

 

  • In HTMLIntroduce CSSMethod

1.Inline

<H1 style = "color: white; background-color: blue">

This is a line of Text.

2.Embedded

<Style>

H1 {

Color: white;

Background-color: blue

}

</Style>

3.Import Type

<Style>

@ Import "mystyle.css ";

</Style>

4.Link Type

<Link href = "mystyle.css" rel = "stylesheet"/>

 

  • Basic CSSSelector

1.Tag selector:HTML Tag

2.CATEGORY selector:. Category name

3. IDSelector:# ID

 

  • Compound Selector

1."Intersection"Selector

Div. special {......}

Div # special {......}

2."Union set"Selector

Div, h1.first, p. special {......}

3.Descendant Selector

Div h1.first span. firstLetter {......}

4.Sub-selector (IE6Not Supported)

P> span {......}

 

  • CSSInheritance features

CSS inheritance means that the child tag inherits all style styles of the parent tag and can be modified based on the style of the parent tag to generate a new style, the style of the Child tag does not affect the parent tag.

 

  • CSSStack features

Priority rules:Intra-row style> ID style> category style> markup style

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.