HTML Element <font> Example
The HTML element <font>
is used to define a font style for its text, which can apply font face, font size, and font color.
This element is not supported in HTML5 and you should avoid using it in the markup. Instead, use CSS font properties.
Here is an example that explains the element in action. Click the below link to see the live demo.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Example - HTML Element font</title>
</head>
<body>
<!-- This element is obsolete and not valid in HTML5, so avoid using it in your markup -->
<p>This paragraph contains a <font size="5" color="red">text</font> that is styled using font element.</p>
<!-- Alternative and better way is to use CSS font properties as shown below. -->
<p>This paragraph contains a <span style="font-size: 18px; color: green;">text</span> that is styled using CSS font properties.</p>
</body>
</html>