CSS - text-align-last
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.
Example
CSS
Copy Code
div { text-align: justify; -moz-text-align-last: center; text-align-last: center; }
Syntax
CSS
Copy Code
/* 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;
Values
auto
- The affected line is aligned per the value of
text-align
, unlesstext-align
isjustify
, in which case the effect is the same as settingtext-align-last
toleft
. start
- The same as
left
if direction is left-to-right andright
if direction is right-to-left. end
- The same as
right
if direction is left-to-right andleft
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 syntax
CSS
Copy Code
auto <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> start <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> end <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> left <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> right <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> center <a title="Single bar" href="css/value_definition_syntax#single_bar">|</a> justify
Description
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.
Initial value | auto |
---|---|
Applies to | block containers |
Inherited | yes |
Media | visual |
Computed value | as specified |
Animatable | no |
Canonical order | the unique non-ambiguous order defined by the formal grammar |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 35[1] 47 |
12.0 (12.0)-moz 49.0 (49.0) |
5.5[2] | No support | No support[3] |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | No support[1] | 12.0 (12.0)-moz 49.0 (49.0) |
6.0[2] | No support | No support[1] |
[1] Enabled through the "Enable Experimental Web Platform Features" flag in chrome://flags
[2] In Internet Explorer, the start
and end
values are not supported.
[3] See WebKit bug 76173.
See Also
Specifications
Specification | Status | Comment |
---|---|---|
CSS Text Level 3 The definition of 'text-align-last' in that specification. |
Working Draft | Initial definition |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/css/text-align-last