CSS TEXT-ALIGN-LAST
This property can be used in conjunction with the ‘text-align’ property, but the value specified overrides the effects of that property on the horizontal alignment of the last or only rendered line of an element.
Examples
div {
text-align: justify;
text-align-last: right
}
Possible Values
left: Left aligns the content on the last or only rendered line of the element.
right: Right aligns the content on the last or only rendered line of the element.
center: Center aligns the content on the last or only rendered line of the element.
inherit: Explicitly sets the value of this property to that of the parent.
auto: Text content on the last line is aligned according to the value of the ‘text-align’ property, the default text-alignment for the block or its inherited ‘text-align’ value.
justify: Applies double text justification to the content on the last or only rendered line of the element.
5 Responses
This is wonderful information but.. what about alignment for images as backgrounds with CSS? I often use designs and pictures that for CSS backgrounds and I can’t figure out how to align them so I can match pixels perfectly. Do you know anything of the such?
@ ScoDal :
no possibility for css 2 or lower :P
but ftw: http://www.css3.com/css-background-position-y/
Text-align-last does not work in Firefox 3. Any workarounds to make it work?
Here’s a cross-browser method that works in Firefox: http://kristinbradley.com/blog/2011/07/09/cross-browser-css-justify-last-line-of-text/
It involves using the :after pseudo-element.
Thanks for Posting….It was very helpful…..!