CSS basics 1--CSS style sheets and style rules
1,CSS (Cascading Style Sheets) Stacked Style Sheets. Used to define the display form of HTMl elements. It is a standard technology developed by W3C to format webpage content.
2,CSSAs one of the technologies that every website designer must master, there are severalAdvantages:
(1) Improve the page browsing speed and save at least 50% of the file size than the traditional text Design Method
(2) Shorten the revision time and reduce maintenance costs
(3) better control of page layout by combining CSS and DIV
(4) Separation of performance, structure, and content
(5) easier search engines
3. CSS style sheets
(1)Embedded style sheet
UseEmbedded Style (2)External style sheet
Create external.CSS file, write the CSS code, and then.Html file links.
Syntax:
(3)Inline style sheet
It is only used for some web page elements, and its function scope is limited to the web page elements that apply it. inline styles are included in HTML tags.
For example, inline Style
4. style rules
(1)Selector: Specifies the element or element that the style rule can act on in the HTML document. In the style rule, the selector is left on the braces.
For example, h1 in h1 {color: orange; background-color: # eea ;}
(2)Declare Block: Section between braces
For example, in h1 {color: orange; background-color: # eea;}, color: orange; background-color: # eea;
(3)Statement:Each statement must use a semicolon (.
For example, color: red in h1 {color: red;} is a declaration.
There can be multiple declarations in a declaration block. Each declaration must be separated by a semicolon.
(4)Attribute
For example, color in h1 {color: red;} is an attribute. Each declaration can have only one attribute.
(5)Note
CSS comments:/* comments */
Shortcut: ctrl + "/"