Style textAlignLast attribute

Definition and usage

textAlignLast This property specifies how to align the last line of the text.

Note:textAlignLast The property is only applicable when the text-align property is set to "justify" elements.

See also:

CSS Reference Manual:text-align-last property

Example

Align the last line of the paragraph to the right:

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

Try it yourself

Syntax

Return textAlignLast property:

object.style.textAlignLast

Set textAlignLast property:

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

Attribute value

Value Description
auto

Default value. The alignment rule of each line is determined by the value of text-align.

When the value of text-align is justify, the behavior of text-align-last is the same as setting start.

left Aligns the last line to the left.
right Aligns the last line to the right.
center Centers the last line.
justify Aligns the last line with the other lines (both ends).
start Aligns the last line of the text at the beginning of the line (if the text direction is from left to right, it is left-aligned, if the text direction is from right to left, it is right-aligned).
end Aligns the last line of the text at the end of the line (if the text direction is from left to right, it is right-aligned, if the text direction is from right to left, it is left-aligned).
initial Sets this property to its default value. See initial.
inherit Inherits this property from its parent element. See inherit.

Technical details

Default value: auto
Return value: A string that represents the text-align-last property.
CSS version: CSS3

Browser support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supporto Supporto Non supportato
Si prega di utilizzare
MozTextAlignLast
Supporto Supporto