English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS reference manual

CSS @rules (RULES)

CSS attributes in full

CSS3 text-align-Usage and examples of the 'last' property

text-align-The 'last' CSS property specifies how to align the last line of text. Note:text-align The property only takes effect in text-The 'align' property only takes effect when set to 'justify'.

The table below provides usage instructions and version history for this property, as well as the syntax for using this property in JavaScript scripts.

Default Value:auto
Applies To:Block Container
Inheritance:Yes
Animatable:No.Please see Animation Attribute.
Version: CSS3the new feature
JavaScript Syntax:object.style.textAlignLast="center"

text-align-The syntax of last usage

The syntax of this attribute is as follows:

text-align-last: auto | start | end | left | right | center | justify | initial | inherit

The following examples demonstrate how to use text-align-last attribute.

p {
    -moz-text-align-last: right; /* Firefox */
    text-align-last: right; 
}
Test See‹/›

Attribute Value

The following table describes the values of this attribute.

ValueDescription
auto

The last line is aligned according to text-The value of align attribute aligns, unless text-align is set to justify.

startThe last line is aligned at the beginning of the line (if text-If direction is from left to right, then aligned to the left; if text-If direction is from right to left, then aligned to the right).
endThe last line is aligned at the end of the line (if text-If direction is from left to right, then aligned to the right; if text-If direction is from right to left, then aligned to the left).
leftThe last line is aligned to the left.
rightThe last line is aligned to the right.
centerThe last line is centered.
justifyThe last line is adjusted to be aligned at both ends.
initialSet this attribute to its default value.
inheritIf specified, the associated elements adopt the text of their parent element.-align-The value of the last attribute.

Browser Compatibility

text-align-The compatibility of last attribute in browsers, the numbers in the table below represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 12+ -moz-

  • Google Chrome35+

  • Internet Explorer 5.5Above

  • Apple Safari ×

  • Opera ×

Read More

Please refer to the following tutorials:CSS Alignment.

Related Attributes:text-align,text-indent,text-justify.