HTML - font tag

Here you learn how to code the font tag.

Font tag - Do Not Use

The <font> tag is used to format the text on a page. Webmasters no longer use this tag much though as CSS has replaced a lot of the formatting that was done with HTML. The World Wide Web Consortium (W3C), which sets the standards for HTML, has removed the font tag from its recommendations. You can learn CSS font formatting on this page (I also show an example below with some inline CSS.

PHP Page

<html>
<head>
<title>HTML tutorial</title>
</head>

<body>
<br>
<font size="2">The "size=2" attribute defines the font size.</font><br>
<font size="+1">The "size=+1" increases the font size.</font><br>
<font size="-1">The "size=-1" decreases the font size.</font><br>
<font face="verdana">The "face=verdana" attribute defines the font name.</font><br>
<font color="#2DDB01">The "color=#2DDB01" attribute with hexcode sets the font color.</font><br>
<font color="red">The "color=red" attribute defines the font color using a color name.</font><br>
<font color="red" size="+1">This uses more than 1 formatting.</font><br><br>
</body>

</html>



This is how it looks


The "size=2" attribute defines the font size.
The "size=+1" increases the font size.
The "size=-3" decreases the font size.
The "face=courier" attribute defines the font name.
The "color=#2DDB01" attribute defines the font color using a hexcode.
The "color=red" attribute defines the font color using a color name.
This uses more than 1 formatting.

Font formatting with Inline CSS

This example shows font formatting using CSS. In practice, the CSS would be stored in a seperate CSS file with each font defined as a 'class'. Check out our CSS section on how to do this.

PHP Page

<html>
<head>
<title>HTML tutorial</title>
</head>

<body>
<br>
<font style="font-size:80%">This sets the font size.</font><br>
<font style="font-size:150%">This sets the font size.</font><br>
<font style="font-family:courier">This sets the font name.</font><br>
<font style="color:#2DDB01">This sets the font color by hexcode.</font><br>
<font style="color:red">This sets the font color by name.</font><br><br>
<font style="font-family:verdana; font-size:80%; color:purple">This is an example of using all attributes together.</font><br>


</body>

</html>



This is how it looks


This sets the font size.
This sets the font size.
This sets the font name.
This sets the font color by hexcode.
This sets the font color by name.
This is an example of using all attributes together.


 
Bookmark this page:
   
 
Shared Hosts
Lunarpages.com Web Hosting

Domain Registrars
PPC Networks
Logos
Affiliate Networks
Resources