Spec-Zone.ru › CSS

`text-align-last` CSS property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It's been available across browsers since September 2022.

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

text-align-last: right;
text-align-last: center;
text-align-last: left;
<section id="default-example">
  <div>
    <p id="example-element">
      Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
      aliquip ex ea commodo consequat.
    </p>
  </div>
</section>
section {
  font-size: 1.5em;
}

#default-example > div {
  width: 250px;
}

#example-element {
  text-align: justify;
}

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: revert-layer;
text-align-last: unset;

Values

This property is specified as one of the following keyword 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 definition

Initial value auto
Applies to block containers
Inherited yes
Computed value as specified
Animation type discrete

Formal syntax

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

Examples

Justifying the last line

<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>

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

Desktop Mobile
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
47
12
49
12–53
34
16
47
49
14–53
34
16
5.0
47
16
auto
47
12
12
34
16
47
14
34
16
5.0
47
16
center
47
12
12
34
16
47
14
34
16
5.0
47
16
end
47
79
12
34
16
47
14
34
16
5.0
47
16
justify
47
12
12
34
16
47
14
34
16
5.0
47
16
left
47
12
12
34
16
47
14
34
16
5.0
47
16
match-parent
No
No
No
No
16
No
No
No
16
No
No
16
right
47
12
12
34
16
47
14
34
16
5.0
47
16
start
47
79
12
34
16
47
14
34
16
5.0
47
16

See also

  • text-align

© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/text-align-last

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API