49 lines
619 B
Markdown
49 lines
619 B
Markdown
# 1. CSS
|
|||
|
|
|
||
|
|
## 1.1 基础选择器
|
||
|
|
### 1.1.1 元素选择器
|
||
|
|
```css
|
||
|
|
p {
|
||
|
|
color: blue;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
### 1.1.2 类选择器
|
||
|
|
```css
|
||
|
|
.container {
|
||
|
|
width: 100%;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
### 1.1.3 ID 选择器
|
||
|
|
```css
|
||
|
|
#header {
|
||
|
|
background-color: gray;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## 1.2 盒模型
|
||
|
|
```css
|
||
|
|
.box {
|
||
|
|
width: 200px;
|
||
|
|
height: 200px;
|
||
|
|
padding: 20px;
|
||
|
|
border: 1px solid black;
|
||
|
|
margin: 10px;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
|
||
|
|
## 1.3 布局
|
||
|
|
### 1.3.1 Flex 布局
|
||
|
|
```css
|
||
|
|
.flex-container {
|
||
|
|
display: flex;
|
||
|
|
justify-content: space-between;
|
||
|
|
align-items: center;
|
||
|
|
}
|
||
|
|
```
|
||
|
|
### 1.3.2 Grid 布局
|
||
|
|
```css
|
||
|
|
.grid-container {
|
||
|
|
display: grid;
|
||
|
|
grid-template-columns: repeat(3, 1fr);
|
||
|
|
gap: 10px;
|
||
|
|
}
|