Learn HTML step-by-step from A to Z or improve your professional skills.  Home HTML and CSS Tutorials Aligning Text
Your Ad Here

Aligning Text


Aligning Text
<p align=left> aligns a paragraph to the left
<p align=right> aligns a paragraph to the right
<p align=center> centers a paragraph

Alignment attributes can be added to the <p> tag to align the text in a paragraph to the left, right or center (though large chunks of text are rarely aligned right or center).

So if you were to write this in your HTML doc:

<p align=left>I fear my bathroom window. It opens to an airshaft, and when it's hot outside I leave it open. Unfortunately, if it's hot enough for me to open the bathroom window, it is also usually hot enough for my neighbors to open their bathroom windows.

<p align=center>I can hear everything. I can hear them argue, and I can hear them flush the toilet. The heat is bad enough; I don't need to know whether or not Elaine upstairs thinks Jeremy should shave his goatee.

<p align=right>When I moved into the bigger, cheaper apartment next door, I couldn't shake the memory of the wild summer parties I'd overheard. It took me four weeks to even <i>think</i> about using the bathtub. I scoured it until it gleamed, showered, and attempted to sleep. I couldn't. So I asked that it be replaced.

You might consider moving. Oh, and your page would appear like this:

I fear my bathroom window. It opens to an airshaft, and when it's hot outside I leave it open. Unfortunately, when it's hot enough for me to open the bathroom window, it is usually hot enough for my neighbors to open their bathroom windows.

I can hear everything. I can hear them argue, and I can hear them flush the toilet. The heat is bad enough; I don't need to know whether or not Elaine upstairs thinks Jeremy should shave his goatee.

When I moved into the bigger, cheaper apartment next door, I couldn't shake the memory of the wild summer parties I'd overheard. It took me four weeks to even think about using the bathtub. I scoured it until it gleamed, showered and attempted to sleep. I couldn't. So I asked that it be replaced.

Of course, you can use paragraph tags for text that's shorter than a full-on paragraph. For instance, you may want to center some words, like so:

<p align=center>If someone offers you
<p align=center>a breath mint,
<p align=center>take it.

They'll appear like this:

If someone offers you

a breath mint,

take it.

I hope this came in useful!

Author's URL: WebMonkey
Thank you for voting.
Rate this Materials:
Bad 
1 2 3 4 5 Excellent
print this page subscribe to newsletter subscribe to rss

HTML is Hyper Text Markup Language that is used to make hypermedia and hypertext documents for the Web. More HTML and CSS: Most Popular Materials | Fresh Materials | More HTML Tutorials at Markuptutorials.com

Add comments to "Aligning Text"

Only registered users can write comment

Reader's comments