Basic HTML and CSS - Centering Text

Here are is some basic HTML code that can be used to jazz up a web page. I will cover how to bold, italicize and underline text, as well as change the color of text.

There are better ways of accomplishing these task such as using CSS, but I will cover that another time.

Lets start with centering some text.

If you'd like your text to be centered, you can use the <center> tag. Like all HTML tags, it will need to be closed, you do this with the </center> tag. Although this tag is no longer considered to be in active use by the W3C, it is still usable today.

EXAMPLE;

<center>Follow the white rabbit</center>  

You also have the option of using the <p> tag to center a paragraph of text.  At the start of the paragraph, you would enter the tag <p style="text-align: center;"> and close the tag with </p>.  This is the correct way to center text, using CSS (cascading style sheets).

EXAMPLE;

 <p style="text-align: center;"> A paragraph about the white rabbit </p>

This entry was posted on Thursday, November 2nd, 2006 at 8:36 am and is filed under Getting Started, Random. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

 

One Response to “Basic HTML and CSS - Centering Text”

  1. Morgan Says:

    Nice, simple and to the point, I like it. Now keep them coming.

Leave a Reply