1.經常使用的應用文本的CSS樣式:css
color設置文字的顏色ide
font-size 設置文字的大小,如font-size:12px字體
font-family 設置文字的字體,如font-family:‘微軟雅黑’spa
font-style 設置文字是否傾斜,如font-style:'normal',設置不傾斜,‘italic’設置文字傾斜code
font-weight 設置文字是否加粗,如font-weight:bold,設置加粗,normal,不加粗orm
line-height 設置文字行高,至關於在每行文字上下同時加間距,line-height:24pxblog
font 同時設置文字的幾個屬性,寫的順序有兼容性問題,以下順序:font:是否加粗 字號/行高 字體,如:font:normal 12px/36px '微軟雅黑‘utf-8
text-decoration:underline 設置文字的下劃線,去掉:text-decoration:noneit
text-indent 設置文字首行縮進,如:text-indent:24px,只針對首行io
text-align 設置文字的水平對齊方式,center,left,right,
代碼
<head>
<meta charset="utf-8">
<title>經常使用文本樣式</title>
<style type="text/css">
div{ font-size: 30px; font-family: 'Microsoft Yahei'; font-style: italic; text-indent: 60px; } em{ font-style: normal; color: gold; } span{ font-weight: bold; line-height: 80px; text-decoration: underline; } a{ text-decoration: none; /*去掉a連接的下劃線*/ text-align: center; /*沒效果,a標籤的寬帶只有文字寬帶*/ } p{ text-align: center; } </style>
</head>