CSS Property text-align-last








The text-align-last property aligns the last line of a text.

Summary

Initial value
auto
Inherited
yes
CSS Version
CSS3
JavaScript syntax
object.style.textAlignLast="right"
Animatable
no

CSS Syntax

text-align-last: auto|left|right|center|justify|start|end|initial|inherit;

Property Values

auto
Default value. justify and align left for last line
left
last line is aligned left
right
last line is aligned right
center
last line is center-aligned
justify
The last line is justified
start
The last line is aligned at the beginning of the line. Align left if the text-direction is left-to-right, or align right is the text-direction is right-to-left.
end
The last line is aligned at the end of the line.
Align right if the text-direction is left-to-right or
align left is the text-direction is right-to-left.
initial
sets to default value
inherit
Inherits this property from its parent element

Browser compatibility

text-align-last Yes Yes Yes Yes Yes




Example

<!DOCTYPE html>
<html>
<head>
<style>
div {<!--  w  w w.  j a v  a  2s.c  o m-->
    text-align: justify;
    -moz-text-align-last: right; /* Code for Firefox */
    text-align-last: right;
}
</style>
</head>
<body>

<div>
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 
this is a test. this is a test. this is a test. this is a test. this is a test. 

</div>

</body>
</html>

Click to view the demo