CSS文本

文本

text-align 对齐元素中的文本 / text-indent 缩进元素中文本的首行

.css

 body{
color: red
}

p{
width:300px;
height: 200px;
background-color: aquamarine;
text-align: center;/文本居中/
text-indent: 2em;/首行缩进2/
}

.html

 





Document



text color testtext color testtext color testtext color testtext color testtext color test



CSS文本_第1张图片
image

text-transform 控制元素中的字母

.css

 body{
color: red
}

p{
width:300px;
height: 100px;
background-color: aquamarine;
text-align: center;/文本居中/
text-indent: 2em;/首行缩进2/
}

ca{

text-transform: capitalize
/* 首字母大写 */
}

up{

text-transform: uppercase
/* 全部大写 */
}

low{

text-transform: lowercase
/* 全部小写 */
}

.html

 





Document



text color testtext color testtext color testtext color testtext color testtext color test


Hello world


Hello world


Hello world



CSS文本_第2张图片
image

line-height 设置行高

CSS文本_第3张图片
image

.css

 div{
height:300px;
width: 100px;
background-color:aquamarine;
line-height: 300px;
}

.html

 





Document



hello world


CSS文本_第4张图片
image

文本属性

属性 描述
color 设置文本颜色
direction 设置文本方向。
line-height 设置行高。
letter-spacing 设置字符间距。
text-align 对齐元素中的文本。
text-decoration 向文本添加修饰。
text-indent 缩进元素中文本的首行。
text-shadow 设置文本阴影。CSS2 包含该属性,但是 CSS2.1 没有保留该属性。
text-transform 控制元素中的字母。
unicode-bidi 设置文本方向。
white-space 设置元素中空白的处理方式。
word-spacing 设置字间距。

你可能感兴趣的:(CSS文本)