color -> image -> repeat -> attachment -> position
2. 基础样式
2.1 段落样式
2.1.1 段落缩进
em – 当前字体倍数
百分比 – 当前页面宽度
in – 英寸
mm – 毫米
pt – 磅 – 72分之一英寸
px – 像素
1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Document</title>
</head>
<body>
<pstyle="padding: 2em;text-indent: -2em;color: #333;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio neque dolores quia, et at animi sequi recusandae cupiditate voluptate iusto in nisi doloribus laborum architecto, laboriosam nesciunt, autem tenetur ab.</p>
</body>
</html>
2.1.2 间距与对齐
1
2
3
4
5
6
7
8
9
10
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Document</title>
</head>
<body>
<pstyle="text-indent: 2em; line-height: 2; text-align: justify; word-spacing: 20px; letter-spacing: 5px;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Distinctio neque dolores quia, et at animi sequi recusandae cupiditate voluptate iusto in nisi doloribus laborum architecto, laboriosam nesciunt, autem tenetur ab.</p>
</body>
</html>
2.2 文本样式
2.2.1 文字修饰与空格处理
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Document</title>
</head>
<body>
<pstyle="text-transform: uppercase;">Lorem ipsum dolor sit amet.</p>
<pstyle="text-transform: lowercase;">Lorem ipsum dolor sit amet.</p>
<pstyle="text-transform: capitalize;">Lorem ipsum dolor sit amet.</p>
<pstyle="text-decoration: underline;">Lorem ipsum dolor sit amet.</p>
<pstyle="text-decoration: underline overline;">Lorem ipsum dolor sit amet.</p>
<pstyle="text-decoration: line-through;">Lorem ipsum dolor sit amet.</p>
<pstyle="white-space: normal;">Lorem ipsum dolor sit amet.</p>
<pstyle="white-space: pre;">Lorem ipsum
dolor sit amet.</p>
<pstyle="white-space: pre-wrap;">Lorem ipsum
dolor sit amet.</p>
<pstyle="white-space: nowrap;">Lorem ipsum
dolor sit amet.</p>
<pstyle="white-space: pre-line;">Lorem ipsum
dolor sit amet.</p>
<pstyle="direction: rtr;">Lorem ipsum dolor sit amet.</p>
</body>
</html>
2.2.2 字体
font-family 字体系列
serif
sans-serif
monospace
cursive
fantasy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Document</title>
</head>
<body>
<pstyle="font-family: serif;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-family: sans-serif;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-family: monospace;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-family: cursive;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-family: fantasy;">Lorem ipsum dolor sit amet.</p>
</body>
</html>
2.2.3 文字修饰
font-style
normal
italic – 使用斜体字
obique – 让没有斜体属性的文字倾斜
font-variant 变体
font-size 使用em相对不错
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<htmllang="en">
<head>
<metacharset="UTF-8">
<title>Document</title>
</head>
<body>
<pstyle="font-style: normal;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-style: italic;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-style: oblique;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-variant: small-caps;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-weight: bold;">Lorem ipsum dolor sit amet.</p>
<pstyle="font-size: 0.8em;">Lorem ipsum dolor sit amet.</p>