blog/docs/code/html/css-import.md

38 lines
679 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: CSS引入方式
date: 2022-01-08 15:25:42
tags: [CSS]
categories: [CSS]
author: Anges黎梦
---
> css引入页面的方式有三种
## 1、内联式
> 通过标签的style属性在标签上直接写样式。
```html
<div style="width:100px; height:100px; background:red ">
......
</div>
```
## 2、嵌入式
> 通过style标签在网页上创建嵌入的样式表。
```html
<style type="text/css">
div{
width:100px; height:100px; background:red
}
......
</style>
```
## 3、外链式
> 通过link标签链接外部样式文件到页面中。
```html
<link rel="stylesheet" type="text/css" href="css/main.css">
```