Thursday, August 23, 2012

how to use font tags in html and how to change text size in html

How to add font tags in html?
In html we write text in body and head like this
<head> this is the first text </head>
                     or
<body> this is the first text </body>
In above case we cant add any style or change size of text,so to handle text
we use font tags <font> sample text</font> .this is how you should use font tags.

Example:
<html>
        <head>
        <font color="red"> some text here</font>
        </head>
        <body>
        <font size="10px">this is body of the text</font>
        </body>
</html>

we can add the color to the text we desired by using 'color' attribute ,
the valid color attributes are red,blue,green,black,yellow,pink,purple.for other
colors we use #ffccdd or #124356 hexadecimal color codes.

Text size can be altered by using 'size' attribute.
you can give the size to be in pixels by px ,or inch ,cm .

There are other heading tags starts from h1 to h5 with decreasing size of text.
<h1>head 1</h1>
<h2>heading h2</h2>
<h3>heading h3</h3>
<h4>heading h4</h4>
<h5>heading h5</h5>

output of above code:

head 1

heading h2

heading h3

heading h4

heading h5

Example:
<html>
        <head>
        <font color="red"> some text here</font>
        </head>
        <body>
        <font size="10px">this is body of the text</font>

       <h1>head 1</h1>
       <h2>heading h2</h2>
       <h3>heading h3</h3>
       <h4>heading h4</h4> 
       <h5>heading h5</h5>

        </body>
</html>

here you are done with learning how to add font tags and changing size of text in html.

<<back     next>>


No comments:

Post a Comment