Wednesday, February 4, 2015

Fonts in HTML

Use of different font styles


We can change font style using “font” tag
General syntax of a font tag
<FONT size=value color=colour face=font types></FONT>
We can use many font types by using commas.
Example:
<FONT face=Courier New,Times New Roman> This is Some text</FONT>
Here if first font is not available then browser show the text using second font.


How to change font size
General Syntax : <FONT size=value ></FONT>
Can change according to 2 methods.
1.use of numbers
We can use numbers from 1 to 7
1 for smallest 7 for largest and 3 for normal size
Then 1 and 2 are smallest size,3 is normal size and 4 to 7 are large size.
2.Use of relative values
Use +1 to +6 for increasing values and -1 to -6 for decreasing values

Example,
<FONT size=2 >This is font size 2</FONT>
<FONT size=7 >This is font size 7 (larger)</FONT>
<FONT size=+3 >This is relative font size +3</FONT>


Complete code,
<HTML>
<HEAD>
<TITLE>Fonts</TITLE>
</HEAD>
<BODY >
<P><FONT face=Courier New,Times New Roman > This is Some text</FONT><br/>
<FONT face=Times New Roman,Courier New,Georgia size=5> This is Some text</FONT><br/>
<FONT size=2 face=Courier New>This is font size 2</FONT><br/>
<FONT size=7 >This is font size 7 (larger)</FONT><br/>
<FONT size=+3 >This is relative font size +3</FONT><br/>
<FONT size=-1 >This is relative font size -1</FONT></P>
</BODY>
</HTML>



Output,


No comments:

Post a Comment