CSS 文本格式
那么什么是文本颜色呢?
我们可以使用颜色属性描述文字的颜色。
CSS中设置颜色的方式:
- 颜色的名称 - 如: red
- 一个RGB值 - 如: RGB(255,0,0)
- 十六进制值 - 如: #FF0000
举例说明:
h1 {color:#aaaaaa;}
h2 {color:rgb(0,255,0);}
body {color:green;}
那么对齐方式怎么设置呢?
文本有很多中对其方式,例如居中,两端对齐,对齐到左或者右。
举例说明:
p.main {text-align:justify;}
p.date {text-align:right;}
h1 {text-align:center;}
那么怎样设置文本修饰呢?
我们可以使用text-decoration来删除或者设置文本修饰。
举例说明:
p1 {text-decoration:overline;}
p2 {text-decoration:line-through;}
p3 {text-decoration:underline;}
那么怎样设置文本转换?
我们可以使用text-transform来设置文本中的大写或者小写。
举例说明:
h1.capitalize {text-transform:capitalize;}
h2.lowercase {text-transform:lowercase;}
h3.uppercase {text-transform:uppercase;}
那么怎样设置文本缩进呢?
我们可以使用text-indent来表示文本第一行缩进。
举例说明:
p {text-indent:3px;}