文本
文本的屬性包括:文字間距、對齊方式、上標、下標、排列方式、首行縮進。
word-spacing設置單詞之間的間距letter-spacing設置字符之間的間距text-align設置本文的水平的對齊方式,取值可以是leftrightcenterjustfytext-indent首行縮進(就類似我們寫作文時,要先空兩個)line-height文本所在行的行高
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
.p1 {
word-spacing:20px; /*單詞的間距*/
letter-spacing:20px; /*每個字之間的間距*/
}
.p2 {
text-align: left; /*center*/
text-indent:15px;/*首行縮進*/
background-color:red;
line-height:40px;/*文本所在行的行高*/
}
</style>
</head>
<body>
<p class="p1">Css刪節號-text-overflow: ellipsis. 不過使用text-overflow: ellipsis; 屬性時、文字只能單行出現。若是想要多行文字、就必須要用javascript來判斷。</p>
<p class="p2">Hello,你好嗎?今天天氣真好呀!</p>
</body>
</html>