CSS styles are roughly divided into three types
Let's take a look at an overall picture.
1. Use a connection
There are two sending methods:
A uses the link label
Write the style rules in the. CSS style document, and then use the <link> label to introduce
The method is as follows:
<LINK rel = "stylesheet" href = "CSS file path"
Type = "text/CSS"/>
You can drag a CSS file directly to an HTML page.
Rel = "stylesheet" indicates that the association style between the link and href is a style sheet file.
Type = "text/CSS" indicates that the file type is a style sheet.
The location is usually in the
B use @ import to import
Just like importing a namespace. In Zai <style>... </style>
Styletype = "text/CSS">
<! --
@ Importurl (the address, path, and file name of the imported style table );
-->
</Style>
For example:
<Styletype = "text/CSS">
<! --
@ Importurl (http: // yourweb/example.css );
-->
</Style>
Note that the semicolon at the end of the line is absolutely indispensable!
2
Use
Style
Attribute
Add the style attribute directly to individual element labels or rows.
The call method is as follows:
<Element name style = "attribute 1
: Attribute value 1; Attribute 2: attribute value 2;... "> </element name>
The style syntax is identical to the independent style syntax. For example
<Divstyle = "width: 30px; color: red; font-size: 15px;"> </div>
The advantage of this usage is that in the labels of smart applications, the disadvantage of OME is that there is no uniformity of the entire file;
3
Use
Style
Tag
Place the style inHeadElementStyleLabel,AndBodyLevel
Syntax:
<Style type = "text/CSS">
<! --CSS
Style Sheet
-->
</Style>
The following is an example. <Head> <title> CSS call method </title> <style>. content {background-color: # cccccc; font-size: 14px; width: 240px; Height: 80px; color: Blue; text-align: center ;} </style>
Generally, the entire <style>... </style> structure is written in the
The above shows how to use CSS styles. Thank you for your correction.