text-align-last

Baseline 2022
Newly available

Since September 2022, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.

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.

Try it

Syntax

css
/* 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: revert-layer;
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.

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 valueauto
Applies toblock containers
Inheritedyes
Computed valueas specified
Animation typediscrete

Formal syntax

text-align-last = 
auto |
start |
end |
left |
right |
center |
justify |
match-parent

Examples

Justifying the last line

CSS

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

Results

Specifications

Specification
CSS Text Module Level 3
# text-align-last-property

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
text-align-last
auto

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Requires a vendor prefix or different name for use.
Has more compatibility info.

See also