The textAlignLast
property gets and sets
how to align the last line of a text.
textAlignLast |
Yes | No | Yes (MozTextAlignLast) | Yes | Yes |
Return the textAlignLast property:
var v = object.style.textAlignLast
Set the textAlignLast property:
object.style.textAlignLast=auto|left|right|center|justify|start|end|initial|inherit
Default Value: | auto |
---|---|
Return Value: | A string representing the text-align-last property |
CSS Version | CSS3 |
The following code shows how to align the last line of a paragraph to the right.
<!DOCTYPE html>
<html>
<head>
<style>
#myDIV {<!--from ww w . j a v a2 s . com-->
text-align: justify;
}
</style>
</head>
<body>
<div id="myDIV">
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property. You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
You can use the text-align-last property to align the last line of a text, if the text has the text-align property set to justify. This text is where you will see the result of the text-align-last property.
</div>
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
document.getElementById("myDIV").style.MozTextAlignLast = "right"; // Code for Firefox
document.getElementById("myDIV").style.textAlignLast = "right";
}
</script>
</body>
</html>
The code above is rendered as follows: