How to Create Paragraphs With HTML

Navigation

Sponsors

How To Create Paragraphs With HTML

Save this to Del.icio.us

Getting Started

One of the first things you will need to know how to do with HTML is to create paragraphs, which is extremely simple to do. This is done using <p>Paragraph Conent</p> tags. For example:

<html>
<head>
<title>Example HTML Paragraph</title>
</head>
<body>

<p>Creating a paragraph on a page could be done by using code like this. As this code is placed above the code below, it will appear as the first paragraph.</p>

<p>Again this is the second paragraph as this HTML code is placed below the one above.</p>

</body>
</html>

In HTML white space and new lines are ignored (in most cases) so in the example above there could be formatted without as many of as little lines placed between the code, the text would be formatted in the same way.

Aligning HTML Paragraphs

Depending on the document type you have defined for your HTML page (or none as the case may be) the "align" attribute may or may not work. I will therefore discuss how to align HTML paragraphs using the "style" attribute.

By default most browsers align HTML paragraphs to the left. For this reason you must state when you want a paragraph to be aligned in other ways. As mentioned in the previous paragraph this can be done using the "style" attribute. This attribute is used for inline Cascading Style Sheets (CSS), which will be discussed in more depth later.

Examples of aligning paragraphs to the right / center are shown below. Note the parts that are shown in bold as this is the part that is different from usual.

<html>
<head>
<title>Example HTML Paragraph Alignment</title>
</head>
<body>

<p style = "text-align:right"> Putting paragraph contents within
these tags will make this
paragraph align to the right.</p>

<p style = "text-align:center"> And in the same way this content
will be aligned in the center of
the area it is placed in.</p>

</body>
</html>


[ Back to HTML Tutorials ]


| Forums | Search | Donate | Links | Contact | Scripts | Templates |
Copyright © 2008 SiteToolCenter.com

Website Design

Best Viewed With Mozilla FireFox