The text-align-last CSS property sets how the last line of a block or a line, right before a forced line break, is aligned.

Syntax

/* Keyword values */
text-align-last: auto;
text-align-last: start;
text-align-last: end;
text-align-last: left;
text-align-last: right;
text-align-last: center;
text-align-last: justify;

/* Global values */
text-align-last: inherit;
text-align-last: initial;
text-align-last: unset;

Values

auto
The affected line is aligned per the value of text-align, unless text-align is justify, in which case the effect is the same as setting text-align-last to start.
start
The same as left if direction is left-to-right and right if direction is right-to-left.
end
The same as right if direction is left-to-right and left if direction is right-to-left.
left
The inline contents are aligned to the left edge of the line box.
right
The inline contents are aligned to the right edge of the line box.
center
The inline contents are centered within the line box.
justify
The text is justified. Text should line up their left and right edges to the left and right content edges of the paragraph.

Formal syntax

auto | start | end | left | right | center | justify

Example

p {
  font-size: 1.4em;
  text-align: justify;
  text-align-last: center;
}

Specifications

Specification Status Comment
CSS Text Module Level 3
The definition of 'text-align-last' in that specification.
Working Draft Initial definition
Initial valueauto
Applies toblock containers
Inheritedyes
Mediavisual
Computed valueas specified
Animation typediscrete
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Basic support
Experimental
Chrome Full support 47
Full support 47
No support 35 — 47
Disabled
Disabled From version 35 until version 47 (exclusive): this feature is behind the Enable Experimental Web Platform Features preference (needs to be set to true). To change preferences in Chrome, visit chrome://flags.
Edge Full support 12Firefox Full support 49
Full support 49
No support 12 — 53
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
IE Partial support Partial
Notes
Partial support Partial
Notes
Notes IE only supports text-align-last when text-align is set to justify.
Notes The start and end values are not supported.
Opera Full support YesSafari No support No
Notes
No support No
Notes
Notes See WebKit bug 76173.
WebView Android Full support 47
Full support 47
No support 37 — 47
Disabled
Disabled From version 37 until version 47 (exclusive): this feature is behind the Enable Experimental Web Platform Features preference (needs to be set to true).
Chrome Android Full support 47
Full support 47
No support 35 — 47
Disabled
Disabled From version 35 until version 47 (exclusive): this feature is behind the Enable Experimental Web Platform Features preference (needs to be set to true). To change preferences in Chrome, visit chrome://flags.
Edge Mobile Full support YesFirefox Android Full support 49
Full support 49
No support 14 — 53
Prefixed
Prefixed Implemented with the vendor prefix: -moz-
Opera Android Full support YesSafari iOS No support No
Notes
No support No
Notes
Notes See WebKit bug 76173.
Samsung Internet Android Full support 5.0

Legend

Full support  
Full support
Partial support  
Partial support
No support  
No support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

Document Tags and Contributors

Last updated by: ddbeck,