目录

style textAlignLast 属性

示例

将段落的最后一行向右对齐:

document.getElementById("myDIV").style.textAlignLast = "right";
亲自试一试 »

描述

textAlignLast 属性指定如何对齐文本的最后一行。

笔记:textAlignLast 属性仅适用于 text-align 属性设置为 "justify" 的元素。


浏览器支持

Property
textAlignLast Yes Yes Not supported
Use MozTextAlignLast
Yes Yes

语法

返回 textAlignLast 属性:

object.style.textAlignLast

设置 textAlignLast 属性:

object.style.textAlignLast = "auto|left|right|center|justify|start|end|initial|inherit"

属性值

Value Description
auto Default value. The last line is justified and aligned left
left The last line is aligned to the left
right The last line is aligned to the right
center The last line is center-aligned
justify The last line is justified as the rest of the lines
start The last line is aligned at the beginning of the line (left if the text-direction is left-to-right, and right is the text-direction is right-to-left)
end The last line is aligned at the end of the line (right if the text-direction is left-to-right, and left is the text-direction is right-to-left)
initial Sets this property to its default value. Read about initial
inherit Inherits this property from its parent element. Read about inherit

技术细节

默认值: 汽车
返回值: 一个字符串,表示元素的 text-align-last 属性
CSS版本 CSS3

相关页面

CSS 参考:文本最后对齐属性