1.行内式
在body标签中,通过html属性style实现,<span style="color:red;">
2.嵌入式
在style标签中写css样式,在body中引用
3.导入式 (基本不使用,因为页面会先加载html,然后再去加载css,这样就会造成页面样式的延迟。)
@import(url( xxxxx.css))
1.创建 .css文件写入css样式
div{
color:green;
}
2.使用@import方式导入 .css文件的style
<style>
@import url( .css)
</style>
<body>
import造就了我
</body>
4..链接式
1.新建css文件,拓展名为aaaa.css,内容为css样式
div{
color:yellow;
}
2.在 .html文件<head>中通过<link>标签引入aaaa.css文件
<link href="test.css" type="text/css" rel="stylesheet" /
/*
href:文档相对路径或绝对路径
type:样式的属性是css文本
rel:设置对象和链接目的间的关系,说白了就是指明你链进来的对象是个什么东西的*