Chapter 4 CSS getting started-Water's original learning points:
1. Use CSS
2. Three Methods
3. cascade and inherit
Lecturer: Li Yanhui
This chapter mainly discusses CSS (stacked style sheet) in HTML5, which is used to typeset and format the appearance of HTML documents.
I. UseCSS
A css style consists of one or more style declarations separated by semicolons. Each declared style contains a CSS attribute and a property value.
This is a piece of text.
Description: style is a row style attribute. Color indicates the color attribute, red indicates the color attribute, font-size indicates the font size attribute, and 50px indicates the font size attribute.
Ii. Three Methods
There are three methods to create a CSS style sheet: 1. Embedded style of elements; 2. Embedded style of documents; 3. External style introduction.
1.Embedded element style
This is a piece of text.
Description: Declares the style attribute for the current element.
2.Embedded Document Style
This is a piece of text.
Explanation: InCreate between elements
// External Import
@charset "utf-8";p { color: green; font-style: italic;}
If a style is replaced by a style with a higher priority, but you want to execute this style scheme, you can mark this scheme as an important style (important ).
// Forcibly set the highest priority
color: green !important;
3.Style inheritance
If an element does not set a style related to the parent element, the style of the parent element is integrated using the inheritance mechanism.
//Element inherited
Element Style
This isHTML5
Style inheritance only applies to the appearance of elements (text, color, Font, etc.), while the layout style of elements on the page is not inherited. If you inherit this style, you must use forced inheritance: inherit.
// Forcibly inherit the layout style
This isHTML5