HTML | DOM Style textAlignLast Property
The Style textAlignLast property in HTML DOM is used to set the alignment of the last line of the text.
Syntax:
- Return the textAlignLast property:
object.style.textAlignLast
- Set the textAlignLast property:
object.style.textAlignLast = "auto | left | right | center | justify | start | end | initial | inherit"
Property Values:
- Auto: The last line is justified and left aligned in the container.
- Left: The last line of the text is left aligned.
- Right: The last line of the text is right aligned.
- Center: The last line of the text is center-aligned.
- Justify: The last line is justified(last line occupies entire width of container by inserting extra spaces between the words).
- Start: The last line of the text is left aligned(if direction of text is left-to-right) and right aligned(if direction of text is right-to-left).
- End: The last line of the text is right aligned(if direction of text is left-to-right) and left aligned(if direction of text is right-to-left).
- Initial: Sets the last line to align by its initial value.
- Inherit: The last line inherits its property from parent element.
Example 1:
<!DOCTYPE html><html><head><title>HTML | DOM Style textAlignLast Property</title><style>.right {text-align-last: right;border: 2px solid grey;}.center {text-align-last: center;border: 2px solid black;}</style></head><body><h2style="text-align:center">Text-align-last-Right:</h2><divclass="right"><!-- text-align-last: right; property --><p><fontcolor="green">GeeksForGeekA Computer Science Portal for Geeks</font></p></div><h2style="text-align:center">Text-align-last-Center:</h2><divclass="center"><!-- text-align-last: center; property --><p><fontcolor="green">GeeksForGeekA Computer Science Portal for Geeks</font></p></div></body></html>chevron_rightfilter_noneOutput:

Example 2:
<!DOCTYPE html><html><head><title>HTML | DOM Style textAlignLast Property</title><style>.justify {text-align-last: justify;border: 2px solid grey;}.start {text-align-last: start;border: 2px solid Green;}</style></head><body><h2style="text-align:center">Text-align-last-Justify:</h2><divclass="justify"><!-- text-align-last: justify; property --><p><fontcolor="green">GeeksForGeekA Computer Science Portal for Geeks</font></p></div><h2style="text-align:center">Text-align-last-Start:</h2><divclass="start"><!-- text-align-last: start; property --><p><fontcolor="green">GeeksForGeekA Computer Science Portal for Geeks</font></p></div></body></html>chevron_rightfilter_noneOutput:

Supported Browsers: The browser supported by HTML | DOM Style textAlignLast Property are listed be;ow:
- Google Chrome 47
- Internet Explorer 5.5
- Firefox 49.0, 12.0 -moz-
- Opera 34
Recommended Posts:
- HTML | DOM Style right Property
- HTML | DOM Style top Property
- HTML | DOM Style flexWrap Property
- HTML | DOM Style fontSize Property
- HTML | DOM Style listStyleImage Property
- HTML | DOM Style marginLeft Property
- HTML | DOM Style flexGrow Property
- HTML | DOM Style borderTopLeftRadius Property
- HTML | DOM Style verticalAlign Property
- HTML | DOM Style left Property
- HTML | DOM Style captionSide Property
- HTML | DOM Style letterSpacing Property
- HTML | DOM Style textDecorationLine Property
- HTML | DOM Style borderStyle Property
- HTML | DOM Style borderTopStyle Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



