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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business