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>