css three import methods
In-line import
<!--行内样式:在标签元素中编写一个style属性,编写样式即可-->
<h1 style="color: red">我是标题</h1>
Internal import
<head>
<!-- 内部样式-->
<style>
/* h1是选择器 */
h1{
color:green;
}
</style>
</head>
External import
- link import link
<head>
<!-- 外部样式-->
<link rel="stylesheet" href="style.css">
</head>
h1{
color: blue;
}
- @import import import
<style>
@import "style.css";
</style>
The principle of proximity
Priority: In-line>Internal>External
The grammatical structure of link and import is different. The former is an html tag and can only be used in html source code , while the latter can be regarded as a css style , which is used to introduce css style functions. Import is needed when html is used