HTML Tutorial
How do I get my text and images aligned differently?
The are some simple ways to get your HTML page to have your text and images, as
well as other things, aligned differently. You will learn that these tags are
very beneficial as they make a better looking web page. By default, your text
and images are left justified. That means that if you type something, it will be
attached to the left side of the browser page. If you wish to change that, you
can do that with these alignment tags.
How do I center, left, or right justify text or an image?
This is the center tag and what is does. This can be used with text, or the
image tag. The <center> tag is the easiest way to center a piece of text or an
image.
This is CenteredThe code: <center><b>This is Centered</b></center>
Here is another way to center using the <h1> tag:
Center Align
The code: <h1 align="center">Center Align</h1>
Note: You can left and right justify using the same type of align attributes in
the <h1> tag. The following are a few examples...
Right Align
The code: <h1 align="right">Right Align</h1>
Left Align
The code: <h1 align="left">Left Align</h1>
The other ways to center, right or left align text, without adding a table, are
by using the <div></div> tag and the <p></p> tag. See some examples below:
Using the div tag
<div</div>:
Center Align
The code: <div align="center">Center Align</div>
Right Align
The code: <div align="right">Right Align</div>
Left Align
The code: <div align="left">Left Align</div>
Using the paragraph tag
<p</p>:
Center Align
The code: <p align="center">Center Align</p>
Right Align
The code: <p align="right">Right Align</p>
Left Align
The code: <p align="left">Left Align</p>