textAlign 属性设置或返回块级元素中文本的水平对齐方式。
Property | |||||
---|---|---|---|---|---|
textAlign | Yes | Yes | Yes | Yes | Yes |
返回 textAlign 属性:
object.style.textAlign
设置文本对齐属性:
object.style.textAlign = "left|right|center|justify|initial|inherit"
Value | Description |
---|---|
left | Aligns the text to the left. This is default |
right | Aligns the text to the right |
center | Centers the text |
justify | The text is justified |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
默认值: | 左边 |
---|---|
返回值: | 一个字符串,表示元素内文本的水平对齐方式 |
CSS版本 | CSS1 |
CSS教程:CSS 文本
CSS 参考:文本对齐属性
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!