text-align-last

< css‎ | properties
Jump to: navigation, search

text-align-last

This article is Ready to Use.


W3C Working Draft

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


Compatibility

Do you think this data can be improved? You can ask to add by opening an issue or make a pull request.

Desktop

FeaturesChromeFirefoxInternet ExplorerOperaSafari
Basic support
?
Unknown
?
Unknown
5.5
Yes
?
none
?
Unknown

Mobile

FeaturesAndroidFirefox MobileIE MobileOpera MobileSafari Mobile
Basic support
?
Unknown
12.0
prefix
6.0
Yes
?
none
?
Unknown


Examples

View live exampleThe 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.

HTML

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

CSS

.normal { 
	width: 300px;
	text-align: justify;
	text-align-last: auto;
}

.justified { 
	width: 300px;
	text-align: justify;
	text-align-last: justify;
}



Related specifications

Specification Status Related Changes
CSS Text Module Level 3 W3C Working Draft

See also

Other articles

Attribution

This article contains content originally from external sources.

Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]