textAlignLast style property
Specifies or returns the alignment type of the last or only line of text in the element's contents.
If you want to align text horizontally within an element, use the textAlign property.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
CSS page for this property: text-align-last |
Possible values:
The type of this property is string.
One of the following values:
Default. The text content of the element is aligned like the other lines in the object. | |||||||
The text content of the element is centered. | |||||||
The text content of the element is justified. | |||||||
Aligns the text content of the element to the left. | |||||||
Aligns the text content of the element to the right. |
Default: auto.
Example HTML code 1:
This example illustrates the use of the text-align-last property:
|
||||
<head> <style> .lastLeft { text-justify: distribute; text-align: justify; text-align-last: left; } .lastJustify { text-justify: distribute; text-align: justify; text-align-last: justify; } </style> </head> <body> <div class="lastLeft"> The text of the first line is justified alonglonglonglonglonglonglonglonglongword. Next line is justified, too alonglonglonglongword. The last line is aligned to left. </div> <br /> <div class="lastJustify"> The text of the first line is justified alonglonglonglonglonglonglonglonglongword. Next line is justified, too alonglonglonglongword. The last line is justified, too. </div> </body> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the textAlignLast property in JavaScript:
|
||||
<head> <style> #myDiv { text-align: justify; text-justify: distribute; text-align-last: justify; } </style> <script type="text/javascript"> function ChangeTextAlignLast (selectTag) { // Returns the index of the selected option var whichSelected = selectTag.selectedIndex; // Returns the text of the selected option var alignValue = selectTag.options[whichSelected].text; var div = document.getElementById ("myDiv"); if ('textAlignLast' in div.style) { div.style.textAlignLast = alignValue; } else { alert ("Your browser doesn't support this example!"); } } </script> </head> <body> <div id="myDiv"> Pellentesque metus. Sed rhoncus sem quis augue. Phasellus rutrum dui vitae justo tincidunt sollicitudin. Maecenas magna. Mauris nec orci. Nunc laoreet convallis arcu. Aenean diam urna, condimentum et, facilisis luctus, accumsan et, pede. Praesent quam orci, elementum nec, laoreet at, tristique ac, sem. Sed eu tortor vel dolor laoreet vulputate. Pellentesque faucibus diam et libero. Mauris tristique malesu. align last line within the object </div> Change speech-rate value: <select onchange="ChangeTextAlignLast (this);" size="4"> <option selected="selected" />left <option />right <option />center <option />justify <option />auto </select> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
color
font
fontFamily
fontSize
fontSizeAdjust
fontStyle
fontVariant
fontWeight
textAlign
textAutospace
textDecoration
textIndent
textJustify
textKashidaSpace
textOverflow
textShadow
textTransform
textUnderlinePosition
font
fontFamily
fontSize
fontSizeAdjust
fontStyle
fontVariant
fontWeight
textAlign
textAutospace
textDecoration
textIndent
textJustify
textKashidaSpace
textOverflow
textShadow
textTransform
textUnderlinePosition
External links:
User Contributed Comments