This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for usage in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the specification changes.
The text-align-last CSS property describes how the last line of a block or a line, right before a forced line break, is aligned.
/* 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;
| Initial value | auto |
|---|---|
| Applies to | block containers |
| Inherited | yes |
| Media | visual |
| Computed value | as specified |
| Animation type | discrete |
| Canonical order | the unique non-ambiguous order defined by the formal grammar |
Syntax
Values
auto- The affected line is aligned per the value of
text-align, unlesstext-alignisjustify, in which case the effect is the same as settingtext-align-lasttostart. start- The same as
leftif direction is left-to-right andrightif direction is right-to-left. end- The same as
rightif direction is left-to-right andleftif 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>Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula.</p>
p {
font-size: 1.4em;
text-align: justify;
-moz-text-align-last: center;
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 |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
| Feature | Chrome | Firefox | Edge | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic Support | 35.0 — 47.01 47.0 | 12.0 — 53.0 -moz- 49.0 | (Yes) | (No) | (Yes) | (No)2 |
| Feature | Android | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
|---|---|---|---|---|---|---|---|
| Basic Support | (No) | 35.0 — 47.01 47.0 | (Yes) | 12.0 — 53.0 -moz- 49.0 | (No) | (Yes) | (No)2 |
1. From version 35.0 until version 47.0 (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.
2. See Webkit bug 76173.