text-align-last
Widely availableSince 202296% of users
Controls alignment of the last line of text. Lets you justify all lines except the final one.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since September 2022. Widely available since March 2025.
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
auto- Inherited
- Yes
Quick example
p { text-align: justify; text-align-last: center; }Syntax
auto | start | end | left | right | center | justifyExamples
Center the last line of a justified paragraph
p {
text-align: justify;
text-align-last: center;
}
/* All lines justified except the last, which is centered */Use text-align-last to fix the look of justified paragraphs with short final lines.
Right-align captions
.caption {
text-align-last: right;
}
/* Last (and only) line of caption aligns right */Single-line captions or labels can use text-align-last for right alignment.
Common pitfalls
- Only affects the last linetext-align-last only applies to the final line of a block. Single-line elements behave differently than multi-line.
- Interacts with text-aligntext-align-last overrides text-align for the last line only. If you set text-align: center and text-align-last: right, all lines are centered except the last.
text-align-last browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2022.Safe to use without fallbacks.
Usage96%of people can use this4% use a browser without it.
Browsers
47+
49+
16+
12+Mobile
47+Android
49+Android
16+iOS