text-align-last
Summary
The text-align-last CSS property describes how the last line of a block element or a line before line break is aligned in its parent block element.
Overview table
- Initial value
auto
- Applies to
- block containers
- Inherited
- Yes
- Media
- visual
- Computed value
- specified value
- Animatable
- No
- CSS Object Model Property
textAlignLast
Syntax
text-align-last: auto
text-align-last: center
text-align-last: end
text-align-last: justify
text-align-last: left
text-align-last: right
text-align-last: start
Values
- auto
- Default. Text is aligned like the other lines in the object, using the value of the text-align property.
- 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
- Text is aligned to the left.
- right
- Text is aligned to the right.
- center
- The text is centered within the line box.
- justify
- Text is justified if ‘text-justify’ is ‘distribute’, and the same as
start
value if otherwise.
Examples
The following example shows an embedded style rule that justifies all the lines in the document’s p elements. This is sometimes found in East Asian typography.
<p class="normal">Simple example with "auto" value of text-align-last property. This paragraph needs to be really long in order to show how to work with text-align-last property. It only works because we set a width for this paragraph though.</p>
<p class="justified">Simple example with "justify" value of text-align-last property. In this case, the last line is also justified. This paragraph needs to be really long in order to show how to work with text-align-last property.</p>
.normal {
width: 300px;
text-align: justify;
text-align-last: auto;
}
.justified {
width: 300px;
text-align: justify;
text-align-last: justify;
}
Related specifications
- CSS Text Module Level 3
- W3C Working Draft
See also
Other articles
- CSSStyleDeclarationCSSStyleDeclaration
- currentStylecurrentStyle
- runtimeStyleruntimeStyle
- stylestyle
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]