1、text-align
指定元素文本的水平对齐方式
①left:文本居左排列,默认值。
②right:文本居右排列。
③center:居中排列。
2、text-decoration
规定添加到文本的修饰,下划线、上划线、删除线(依次如下)等等
①underline
②overline
③line-through
3、 text-decoration
控制文本的大小写
①captialize:定义每个单词开头大写
②uppercase:全部大写字母
③lowercase:全部小写字母
4、text-indent
规定文本块中首行文本的缩进
tip:负值是允许的,如果值是负数,将第一行左缩进。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.one{
text-align: center;
text-decoration: underline overline line-through;
text-transform: uppercase;
text-indent: 20px;
}
.two{
text-decoration: underline;
text-transform: capitalize;
text-indent: -30px;
}
</style>
</head>
<body>
<p class="one">我是一段段落red</p>
<p class="two">helloworld</p>
</body>
</html>

该文章介绍了CSS中用于控制文本样式的属性,包括text-align用于设置文本水平对齐,如左对齐、右对齐和居中;text-decoration用于添加下划线、上划线等修饰;text-transform用于调整字母大小写,如首字母大写或全大写;以及text-indent用于设定首行缩进,可使用负值创建特殊效果。示例代码展示了这些属性在实际中的应用。

214

被折叠的 条评论
为什么被折叠?



