The use of Css styles is roughly divided into three types
Let’s take a look at an overview picture first
1 Use the form of connection to call
There are two ways to call:
A Use The link tag
writes the style rules in the .Css style document, and then introduces it with the tag
as follows:
Usually dragging the css file directly to the html page
Concentrate rel="stylesheet" means that the associated style between this link and href is a style sheet file. Type="text/css" means that the file type is a style sheet. The location where it is placed is usually in the
section of the web page.B Using @import to import
is just like importing a namespace. Place it in zai
STYLETYPE="text/css">
For example:
It should be noted that the semicolon at the end of the line is absolutely essential!
2 Use the style attribute
Add the style attribute directly to individual element tags or inline
The calling method is as follows:
The syntax of the style is exactly the same as the syntax of the independent style. For example
The advantage of this usage is that it can be used flexibly in tags, but the disadvantage is that There is no unity of the entire document;
3 Use the style tag
Put the style within the style tag in the head element, at the same level as the body
The syntax is as follows:
[html]