Latest web development tutorials

HTML DOM Style textAlignLast property

Style Object Reference Style Objects

Examples

The last line of the paragraph is aligned to the right:

document.getElementById("myDIV").style.textAlignLast="right";

try it"

Definition and Usage

textAlignLast attribute specifies how to align the text of the last line.

Note: textAlignLast property only when the work is "justify" the text-align property is set.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Only Internet Explorer supports textAlignLast property.

Firefox supports another alternative of the property attribute that MozTextAlignLast property.

Internet Explorer does not support the "start" and "end" value.


grammar

Back textAlignLast properties:

object .style.textAlignLast

Setting textAlignLast properties:

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

Property Value

描述
auto 默认值。最后一行被调整,并向左对齐。
left 最后一行向左对齐。
right 最后一行向右对齐。
center 最后一行居中对齐。
justify 最后一行被调整为两端对齐。
start 最后一行在行开头对齐(如果 text-direction 是从左到右,则向左对齐;如果 text-direction 是从右到左,则向右对齐)。
end 最后一行在行末尾对齐(如果 text-direction 是从左到右,则向右对齐;如果 text-direction 是从右到左,则向左对齐)。
initial 设置该属性为它的默认值。请参阅 initial
inherit 从父元素继承该属性。请参阅 inherit

technical details

Defaults: auto
return value: String that represents text-align-last attribute of the element.
CSS version CSS3


related articles

CSS Reference: text-align = left-attribute Last


Style Object Reference Style Objects