Style textAlignLast attribute

Definition and usage

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

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

See also:

CSS Reference Manual:text-align-last attribute

Example

Align the last line of the paragraph to the right:

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

Try it yourself

Syntax

Return textAlignLast attribute:

object.style.textAlignLast

Set textAlignLast attribute:

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

Attribute value

Value Description
auto

Default value. The alignment rule for 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 of the text to the left.
right Aligns the last line of the text to the right.
center Aligns the last line of the text in the center.
justify Aligns the last line of the text in the same way as 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, and 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, and 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 attribute.
CSS version: CSS3

browser support

Chrome Edge Edge Firefox Safari
Chrome Edge Edge Firefox Safari
MozTextAlignLast MozTextAlignLast Opera
Μη υποστηριζόμενο
Παρακαλώ χρησιμοποιήστε
MozTextAlignLast MozTextAlignLast