Font Handling in HTML
- Fonts In HTML
-
The HTML element FONT is an inline element used to change 3 things:
1.font sizes2.font colors3.font stylesBut it is deprecated in HTML in favour of cascading style sheets.
The reason for this is simple: CSS gives us much more flexibility and many more styling options than the FONT element.
- General Syntax
-
Since <font> tag is uded to change only size,color and style , it has 3 attributes : “face”,”size” and “color”.
<font face=“. . .” size=“ . . .” color=“. . .”>
some text
</font>
Font Face
-
By default browsers use “Times New Roman” as their default font.
-
But if needed we can change it to any other font by using “face” attribute of the <font> tag.
-
As value for the FACE attribute we can use any specific font name such as "verdana", "arial", "georgia", "bookman old style", "comic sans ms" and many more.
- Alternatively may use generic font styles such as "serif", "sans-serif", "cursive", "fantasy" and "monospace".
The above example instructs the browser to display the contained text in arial or helvetica or verdana. If none of them is present then in any “sans-serif” font .
<html>
<head>
<title> Font face Demo! </title>
</head>
<body>
<font face=“arial,helvetica,verdana,sans-serif”>
<p> This is a demo Paragraph! </p>
</font>
</body>
</html>