多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
## 所有CSS文本属性。 | 属性 | 描述 | | :-- | :-- | | [color](https://www.w3cschool.cn/cssref/pr-text-color.html) | 设置文本颜色 | | [direction](https://www.w3cschool.cn/cssref/pr-text-direction.html) | 设置文本方向。 | | [letter-spacing](https://www.w3cschool.cn/cssref/pr-text-letter-spacing.html) | 设置字符间距 | | [line-height](https://www.w3cschool.cn/cssref/pr-dim-line-height.html) | 设置行高 | | [text-align](https://www.w3cschool.cn/cssref/pr-text-text-align.html) | 对齐元素中的文本 | | [text-decoration](https://www.w3cschool.cn/cssref/pr-text-text-decoration.html) | 向文本添加修饰 | | [text-indent](https://www.w3cschool.cn/cssref/pr-text-text-indent.html) | 缩进元素中文本的首行 | | [text-shadow](https://www.w3cschool.cn/cssref/css3-pr-text-shadow.html) | 设置文本阴影 | | [text-transform](https://www.w3cschool.cn/cssref/pr-text-text-transform.html) | 控制元素中的字母 | | [unicode-bidi](https://www.w3cschool.cn/cssref/pr-text-unicode-bidi.html) | 设置或返回文本是否被重写  | | [vertical-align](https://www.w3cschool.cn/cssref/pr-pos-vertical-align.html) | 设置元素的垂直对齐 | | [white-space](https://www.w3cschool.cn/cssref/pr-text-white-space.html) | 设置元素中空白的处理方式 | | [word-spacing](https://www.w3cschool.cn/cssref/pr-text-word-spacing.html) | 设置字间距 | ### direction属性指定文本方向/书写方向。 JavaScript 语法:object.style.direction="rtl" | 值 | 描述 | | --- | --- | | ltr | 默认。文本方向从左到右。 | | rtl | 文本方向从右到左。 | | inherit | 规定应该从父元素继承 direction 属性的值。 | ### letter-spacing 属性增加或减少字符间的空白(字符间距) JavaScript 语法:object.style.letterSpacing="3px" | 值 | 描述 | | --- | --- | | normal | 默认。规定字符间没有额外的空间。 | | *length* | 定义字符间的固定空间(允许使用负值)。 | | inherit | 规定应该从父元素继承 letter-spacing 属性的值。 | h1 {letter-spacing:2px} p {letter-spacing:-3px} ### line-height设置以百分比计的行高 JavaScript 语法:object.style.lineHeight="2" | 值 | 描述 | | --- | --- | | normal | 默认。设置合理的行间距。 | | *number* | 设置数字,此数字会与当前的字体尺寸相乘来设置行间距。 | | *length* | 设置固定的行间距。 | | *%* | 基于当前字体尺寸的百分比行间距。 | | inherit | 规定应该从父元素继承 line-height 属性的值。 | p.small {line-height:90%} p.big {line-height:200%} ### text-align属性指定元素文本的水平对齐方式。 JavaScript 语法:object.style.textAlign="right" | 值 | 描述 | | --- | --- | | left | 把文本排列到左边。默认值:由浏览器决定。 | | right | 把文本排列到右边。 | | center | 把文本排列到中间。 | | justify | 实现两端对齐文本效果。 | | inherit | 规定应该从父元素继承 text-align 属性的值。 | ### text-decoration 属性规定添加到文本的修饰。 JavaScript 语法:object.style.textDecoration="overline" | 值 | 描述 | | --- | --- | | none | 默认。定义标准的文本。 | | underline | 定义文本下的一条线。 | | overline | 定义文本上的一条线。 | | line-through | 定义穿过文本下的一条线。 | | blink | 定义闪烁的文本。 | | inherit | 规定应该从父元素继承 text-decoration 属性的值。 ### text-indent 属性规定文本块中首行文本的缩进。 JavaScript 语法:object.style.textIndent="50px" | 值 | 描述 | | --- | --- | | *length* | 定义固定的缩进。默认值:0。 | | *%* | 定义基于父元素宽度的百分比的缩进。 | | inherit | 规定应该从父元素继承 text-indent 属性的值。 | p { text-indent:50px; } ### text-shadow 属性应用于阴影文本。 JavaScript 语法:object.style.textShadow="2px 2px #ff0000" | 值 | 描述 | | --- | --- | | *h-shadow* | 必需。水平阴影的位置。允许负值。 | | *v-shadow* | 必需。垂直阴影的位置。允许负值。 | | *blur* | 可选。模糊的距离。 | | *color* | 可选。阴影的颜色。参阅 [CSS 颜色值](https://www.w3cschool.cn/cssref/css-colors-legal.html "CSS 合法颜色值")。 | h1 { text-shadow: 2px 2px #ff0000; }【W3C中有在线的阴影字体调节】 ### text-transform 属性控制文本的大小写。 JavaScript 语法:object.style.textTransform="uppercase" | 值 | 描述 | | --- | --- | | none | 默认。定义带有小写字母和大写字母的标准的文本。 | | capitalize | 文本中的每个单词以大写字母开头。 | | uppercase | 定义仅有大写字母。 | | lowercase | 定义无大写字母,仅有小写字母。 | | inherit | 规定应该从父元素继承 text-transform 属性的值。 | ### vertical-align属性设置一个元素的垂直对齐。 JavaScript 语法:object.style.verticalAlign="bottom" | 值 | 描述 | | --- | --- | | baseline | 默认。元素放置在父元素的基线上。 | | sub | 垂直对齐文本的下标。 | | super | 垂直对齐文本的上标 | | top | 把元素的顶端与行中最高元素的顶端对齐 | | text-top | 把元素的顶端与父元素字体的顶端对齐 | | middle | 把此元素放置在父元素的中部。 | | bottom | 把元素的顶端与行中最低的元素的顶端对齐。 | | text-bottom | 把元素的底端与父元素字体的底端对齐。 | | length |   | | % | 使用 "line-height" 属性的百分比值来排列此元素。允许使用负值。 | | inherit | 规定应该从父元素继承 vertical-align 属性的值。 | ### white-space属性指定元素内的空白怎样处理。 JavaScript 语法:object.style.whiteSpace="pre" | 值 | 描述 | | --- | --- | | normal | 默认。空白会被浏览器忽略。 | | pre | 空白会被浏览器保留。其行为方式类似 HTML 中的 标签。 | | nowrap | 文本不会换行,文本会在在同一行上继续,直到遇到 标签为止。 | | pre-wrap | 保留空白符序列,但是正常地进行换行。 | | pre-line | 合并空白符序列,但是保留换行符。 | | inherit | 规定应该从父元素继承 white-space 属性的值。 | ### word-spacing属性增加或减少字与字之间的空白。 JavaScript 语法:object.style.wordSpacing="10px" | 值 | 描述 | | --- | --- | | normal | 默认。定义单词间的标准空间。 | | *length* | 定义单词间的固定空间。 | | inherit | 规定应该从父元素继承 word-spacing 属性的值。 |