text-align-last
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: revert;
text-align-last: unset;
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 definition
| Initial value | auto |
|---|---|
| Applies to | block containers |
| Inherited | yes |
| Computed value | as specified |
| Animation type | discrete |
Formal syntax
Examples
Justifying the last line
CSS
p {
font-size: 1.4em;
text-align: justify;
text-align-last: center;
}
Results
Specifications
| Specification |
|---|
| CSS Text Module Level 3 (CSS Text 3) # text-align-last-property |
Browser compatibility
BCD tables only load in the browser
