Div + CSS video learning notes

Source: Internet
Author: User

1. The section (P tag) cannot be nested with Div.
2. CSS: stacked style files. The same tag can be modified with multiple styles.
3.css type: inline, embedded, external, and input.

Inline:
<P style = "font-size: 50px; color: red; Background-color: green; text-Decoration: underline"> aaaaaaaaaaa </P>
Disadvantage: Poor reusability.

Embedding:
<Style type = "text/CSS">
<! --
P {
Font-size: 50px;
Color: red;
Background-color: green;
Text-Decoration: underline;
}
// -->
</Style>
Benefits: You can control some tags of the entire web page.

External:
<LINK rel = "stylesheet" type = "text/CSS" href = "test.css">

Input:
Use @ import url(demo.css) in the CSS file or style label );

4. Style rule selector:
HTML selector, class selector, Id selector, Association selector, combination selector, and pseudo element selector.

HTML selector:
P {
Font-size: 50px;
Color: red;
Background-color: green;
Text-Decoration: underline;
}

Class selector:
// Only use for P label
P. One {
Color: red;
Font-size: 2 cm;
Background: green;
}

// Use for any label
. Two {
Color: red;
Font-size: 2 cm;
Background: green;
}

<P class = "one"> adfsdf </P>

Id selector:
# One {
Color: red;
Font-size: 2 cm;
Background: green;
}
<P id = "one"> adfsdf </P>

Association selector:
P em {
Color: red;
Font-size: 2 cm;
Background: green;
}

. One. Two em {
Color: red;
Font-size: 2 cm;
Background: green;
}

<P>
<Em> dfdf </em>
</P>

Combination selector:
P, Div, A, H1,. One, # Two {
Color: red;
Font-size: 2 cm;
Background: green;
}

Use one of them.

Pseudo element selector:
A: link {font-size: 1 cm; color: Red}
A: hover {font-size: 5 cm; color: Green}
A: visited {font-size: 2 cm; color: yellow}
A. One: link {font-size: 8 cm; color: Blue}
Div A. One: link {font-size: 12 cm; color: Black}

<A href = "dfdf"> dfdfdfdf </a>
<A href = "dfdfdf" class = "one"> ffffff </a>
<Div>
<A href = "dfdfdf" class = "one"> ffffff </a>
</Div>

5. Advantages of Div + CSS: separation of performance and content, shortening the revision time and reducing bandwidth costs.
Paragraph with P, title with HX
A table only needs to be used to display data, not for layout.

Margin: margin
Two methods:
. Bianju {
Margin-left: 10 cm;
Margin-top: 40 cm;
Margin-bottom: 4 cm;
Margin-Right: 40 cm;
}

. Bianju {
Margin: 10px 20px 30px 40px;
}

Auto indicates automatic.

Padding:
TD {
Padding-left: 4 cm;
Padding-Right: 4 cm;
Padding-top: 4 cm;
Padding-bottom: 4 cm;
}

P {
Float: Right; // which side is aligned, three types of right, left, none
}

. One {
Clear: none;
Clear: left;
Clear: right;
Clear: both;
}


Downloadable attachment: Demo

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.