CSS修饰文本属性
CSS修饰文本属性
文字大小: font-size
字体颜色:color
水平居中对齐: text-align:center
水平居右对齐: txet-align:right
单行文本垂直居中:line-height:数值
首行缩进:text-indent:2em
文本修饰:
没有修饰:text-decoration:none(一般用于超链接)
修饰下划线:text-decoration:underline
修饰上划线:text-decoration:overline
修饰删除线:text-decoration:line-through
案例1:
<!DOCTYPE html>
<html lang="en">
<head> <meta charset="UTF-8">
<title>CSS文本修饰</title>
<style>
.a1{ font-size: 20px; }
.a2{ color: yellowgreen; }
.a3{ text-align: center; }
.a4{ text-align: right; }
.a5{ background-color: red; height: 40px; line-height: 40px; }
</style>
</head>
<body>
<div class="a1">我是文字大小</div>
<div class="a2">我是文字颜色</div>
<div class="a3">我是文字水平居中对齐</div>
<div class="a4">我是文字水平居右对齐</div>
<div class="a5">我是文字垂直居中</div>
</body>
</html>
共有 0 条评论