Javascript examples for CSS Style Property:textAlignLast
The textAlignLast property sets how to align the last line of a text, which is only working for elements with the text-align property set to "justify".
Value | Description |
---|---|
auto | Default value. The last line is justified and aligned left |
left | aligned to the left |
right | aligned to the right |
center | center-aligned |
justify | justified as the rest of the lines |
start | aligned at the beginning of the line |
end | aligned at the end of the line |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |
Item | Value |
---|---|
Default Value: | auto |
Return Value: | A String, representing the text-align-last property of an element |
CSS Version | CSS3 |
Align the last line of a paragraph to the right:
<!DOCTYPE html> <html> <head> <style> #myDIV {//w w w.j av a 2 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"; // Standard Syntax } </script> </body> </html>