You are here

You can align text left, right, or center. To do this, you use the attribute align. This attribute can be applied to HEADING tags, PARAGRAPH tags, or DIV tags. The DIV tag makes parts of a page look a certain way, but doesn't change spacing like the <P> tag. Use the <DIV align="center"></DIV> tag in place of the <CENTER></CENTER> tag.

Here are possible combinations for the <P> tag:

<P align="left"> aligns a paragraph to the left
<P align="right"> aligns a paragraph to the right
<P align="center"> centers a paragraph

Here are possible combinations for a heading:

<H1 align="left"> aligns a heading to the left
<H1 align="right"> aligns a heading to the right
<H1 align="center"> centers a heading

Here are possible combinations for the <DIV> tag:

<DIV align="left"> aligns a DIV area to the left
<DIV align="right"> aligns a DIV area to the right
<DIV align="center"> centers a DIV area

Use the DIV tag as you would the CENTER tag (it is the more accepted method).

This paragraph is an example of align="right".

This paragraph is an example of align="center".

Okay, let's go back to the index.html file and center the <H1> tag (and adjust the alignment of any other text you like).

  1. Open the index.html file in your text editor.
  2. After the H1 in the <H1>tag type or paste this attribute:
    align="center"

    Now your opening <H1> tag should look like this: <H1 align="center">

  3. Save the file and preview it in your web browser.

Take a look at my file if you want to make sure you're doing this correctly.