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.
CSS
JS
object.style.textAlignLast = "value";
Values
<'text-align-last'> = auto | start | end | left | right | center | justify | match-parent
auto
Automatically specified by the user agent.
start
Inline-level content is aligned to the start edge of the line box.
end
Inline-level content is aligned to the end edge of the line box.
left
Inline-level content is aligned to the line left edge of the line box.
right
Inline-level content is aligned to the line right edge of the line box.
center
Inline-level content is centered within the line box.
justify
Text is justified according to the method specified by the text-justify property, in order to exactly fill the line box.
match-parent
Behaves the same as inherit except that an inherited value of start or end is interpreted against the parent's direction value and results in a computed value of either left or right.
Initial
auto
start
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: start;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start</p>
<p>start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start</p>
</body>
</html>
end
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: end;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end</p>
<p>end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end end</p>
</body>
</html>
left
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: left;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left</p>
<p>left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left left</p>
</body>
</html>
right
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: right;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right</p>
<p>right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right right</p>
</body>
</html>
center
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: center;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center</p>
<p>center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center center</p>
</body>
</html>
justify
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: justify;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify</p>
<p>justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify justify</p>
</body>
</html>
match-parent
<!doctype html>
<html>
<head>
<style>
p {
text-align-last: match-parent;
}
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
</head>
<body>
<p>match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent</p>
<p>match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent match-parent</p>
</body>
</html>
JS
<!doctype html>
<html>
<head>
<style>
p:nth-of-type(2) {
writing-mode: vertical-lr;
}
</style>
<script>
function mouseover(value) {
var elements = document.getElementsByTagName("p");
for (var i = 0; i < elements.length; ++i) {
elements[i].style.textAlignLast = value;
}
}
</script>
</head>
<body>
<input onmouseover="mouseover(value)" type="button" value="auto">
<input onmouseover="mouseover(value)" type="button" value="start">
<input onmouseover="mouseover(value)" type="button" value="end">
<input onmouseover="mouseover(value)" type="button" value="left">
<input onmouseover="mouseover(value)" type="button" value="right">
<input onmouseover="mouseover(value)" type="button" value="center">
<input onmouseover="mouseover(value)" type="button" value="justify">
<input onmouseover="mouseover(value)" type="button" value="match-parent">
<p>text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last</p>
<p>text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last text-align-last</p>
</body>
</html>
Internal
External