CSS embedded in html document combination of the three ways
1. inline style
- Style attribute specified in the tag css code
- Such as:
<div style="color:red;">hello css</div>
2. Internal Style
- In the head tag, the tag body content definition style tags, style css code label is
- Such as:
<style>
div{
color:blue;
}
</style>
<div>hello css</div>
3. External Style
- Css defined resource file.
- In the head tag, tag link defined, the introduction of external resource files
- The introduction of external resource files ways such as:
//a.css文件:
div{
color:green;
}
//在文档内部通过link标签引入,注意使用的是相对路径
<link rel="stylesheet" href="css/a.css">
<div>hello css</div>
<div>hello css</div>
4. Note:
- 1,2,3 ways css effect of increasing the scope
- 1 way is not common, common post-2,3
- A third format of the second wording:
<style>
@import "css/a.css";
</style>