SHARE
Facebook X Pinterest WhatsApp

So, You Want To Align Text, Huh?

Written By
thumbnail
Joe Burns
Joe Burns
Jan 4, 2005

Use these to jump around or read it all…

[Getting Text To Wrap]
[Image In the Center]
[Speaking of Tables…]
[Align One Line of Text]
[Align Two Lines of Text]
[Adding Blank Lines]
[Aligning Text Alone]
[What About Custom Text Shaping?]

Pointer     People ask all the time how to get images onto pages. If you aren’t sure how yet, I cover it in Primer #5. However, once, they get those images onto a page, then they start asking how to get text to align or wrap around the images they have placed on their pages. That’s the purpose of this tutorial, to tell you how to get the text to wrap. Just like this.


A book     It’s actually easier than you think. You see the two images I have so far? Both are wrapped by text, yet one is on the left and one is on the right. I did that by using a normal image command like so:


Sally

Aligning Two Lines of Text

     If you’ve tried the top, middle, and bottom commands above, then you know after you get more than one line of text, the rest jumps to under the picture. Bummer.
     How to get around it is a little more tricky. First off, you only use a left or right ALIGN to get the text started. (Yes, it starts at the top. I’ll explain further.) After you have the amount of text you want, you use this command:

<BR CLEAR=”all”>

     That little doo-dad clears the remainder of the picture wrap and starts you on the next line under the picture. Like so:

Monk

 

This text is next to the Monk’s picture.
This text is also…
(<BR CLEAR=”all”> placed here)
     This text isn’t.

     Now, some may say they want the text to start down the picture a bit. They want the same effect as the ALIGN=”middle” or ALIGN=”bottom” commands above. Easy to do. You add blank lines.


Adding Blank Lines

     But… you say I have tried adding fifty <P> commands and I never get more than one line.That’s true. The reason is because you never put anything on the line after the <P> command. Try this:

<P>&nbsp;<P>

     That’s a great little deal that adds a couple blank lines. Why? Because the &nbsp; is a space. You’ve put something on the line so the next <P> can act. But the space is invisible, so no one sees it and you get two blank lines. Slick, huh? Use a few to “bump” your text down the image face. You can get the same effect by simply adding a slew of <BR> commands too, but this gets the job done quicker with less text.


Aligning Text Alone

     You probably already know about the commands that center the text for you:

<CENTER> and </CENTER>

     You surround the text, tables, images, or whatever, with those two commands and it centers it all. No sweat.
     There’s not much I can tell you about left align either since that happens without you doing anything. It’s that pesky right align that messes people up.

I mean it’s really a rough deal getting the text to do that!
Why, if I could do it… I would!

     Okay, bad joke. But it gets the point across. The text above is right-aligned. And it’s easy. Just surround whatever you want right aligned with this:

<P ALIGN=”right”> and </P>


What About Custom Text Shaping?

     No two ways about it. If you want certain breaks here and there and you want a space here and a line to end there, you have to do all that by hand.

Use…

  • <BR>for a single space text jump.
  • <P>for a double space text jump.
  • &nbsp; to add a space.

     And that wraps it up. Get it?! Wraps?! Man! I can be so funny at times… and then there’s now. *Sigh*

[Getting Text To Wrap] [Image In the Center]
[Speaking of Tables…] [Align One Line of Text]
[Align Two Lines of Text] [Adding Blank Lines]
[Aligning Text Alone] [What About Custom Text Shaping?]

  Enjoy!

Recommended for you...

Best JavaScript Frameworks & Libraries for Building Web Dashboards
Rob Gravelle
Jul 29, 2021
Google Web Vitals for Beginners
Diogo Souza
May 4, 2021
Web Site Maintainability
Vince Barnes
Jan 10, 2021
Getting Started with Grunt.js
Diogo Souza
Oct 8, 2018
HTML Goodies Logo

The original home of HTML tutorials. HTMLGoodies is a website dedicated to publishing tutorials that cover every aspect of being a web developer. We cover programming and web development tutorials on languages and technologies such as HTML, JavaScript, and CSS. In addition, our articles cover web frameworks like Angular and React.JS, as well as popular Content Management Systems (CMS) that include WordPress, Drupal, and Joomla. Website development platforms like Shopify, Squarespace, and Wix are also featured. Topics related to solid web design and Internet Marketing also find a home on HTMLGoodies, as we discuss UX/UI Design, Search Engine Optimization (SEO), and web dev best practices.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.