spacer
Yehuda Shiran September 2, 2000
Aligning the Last Line
Tips: September 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

There are several ways to align the last line or only line of text in the object. You assign it as follows:

object.style.textAlignLast = sAlignLast;

where sAlignLast is one of:

  • auto. The default. Last line aligned like other lines in the object, using the value of textAlign.
  • center. Text is centered.
  • inherit. Text is aligned like in the parent object.
  • justify. Text is right justified.
  • left. Text is left-aligned.
  • right. Text is right-aligned.
The following paragraph demonstrates several of the above alternatives for aligning a single line of text (in IE 5.5 and above):

short line short line

auto center justify left right

Here is how we defined the above paragraph and links:

<P ID="lastLineEffect" STYLE="text-align:justify; text-align-last:auto">
short line short line
</P>
<A HREF="javascript:void(lastLineEffect.style.textAlignLast='auto')">auto</A>
<A HREF="javascript:void(lastLineEffect.style.textAlignLast='center')">center</A>
<A HREF="javascript:void(lastLineEffect.style.textAlignLast='justify')">justify</A>
<A HREF="javascript:void(lastLineEffect.style.textAlignLast='left')">left</A>
<A HREF="javascript:void(lastLineEffect.style.textAlignLast='right')">right</A></P>

Notice that the text-align property must be assigned the value of justify for this example to work.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint