SECTION 2: Formatting Text

HOME
SECTION 1:
Getting Started With HTML

SECTION 2:
Formatting Text

SECTION 3:
Images and Links

SECTION 4:
Lists and Tables


HTML Editor
Sign Guest Book
Links



In this section we'll learn how to format text. You can make text look bold, italic or underline using tags <b>, <i>, <u>. for example:

<b> this is bold text <i> and this is bold and italic text </i> </b>

Headings:
You can insert headings in your HTML document using heading tags (<h1>,<h2>,- - -<h6>). These are 6 headings <h1> is the largest and <h6> is the smallest. In example given below all six heading tags are used.

<h1> Heading1 <h1>
<h2> Heading2<h2>
<h3> Heading3<h3>
<h4> Heading4<h4>
<h5> Heading5<h5>
<h6> Heading6<h6>

Output:

Heading1

Heading2

Heading3

Heading4

Heading5
Heading6

Paragraphs:
You can create paragraphs using <p></p> tags. For example:

<p> This is first paragraph </p>
<p> This is second paragraph </p>

you can align a paragraph using align attribute that accepts alignment values(left, right, center) for example:

<p align="center"> This is paragraph </p>

Font, Color, Size:
If you've used any word-processor like Word, you must be used to changing text properties like style, color, size etc. HTML provides <font> tag to accomplish this. The syntax of font tag with most used attributes is:

<font face="Arial" color="#FF0000" size=1> Text to be formatted </font>

face attribute may contain on or more font names separated by commas. The browser displays text only in first font that is available on that system.
color attribute specifies the color of text. It can be hex code for color (e.g. #FF0000 for red) or color name.
size attribute specifies size of text. I should be an integer from 1 to 7. 1 is the smallest and 7 is the largest.

You can use various formatting tags to achieve desired result e.g.

<font color="#FF0000" size=4><b><i> Hello World! </i></b></font>

Output

Hello World!

<center> Tag:
To center text or embedded objects such as images, simply enclose it within <center> and </center> tag. For example:

<center>
<font color="#FF0000" size=4><b><i> Hello World! </i></b></font>
</center>

This will center align above shown output.