CSS Font property is used to control the look of texts available in an HTML element. .
CSS Font property makes you to change the text size, color, style and more
You can set following font properties of an element −
font-family : This property is used to change the face of the font.
font-style : This property is used to make the font bold, italic or oblique.
font-variant : This property creates a small-caps effect.
font-weight : This property is used to increase or decrease the boldness and lightness of the font.
font-size : This property is used to increase or decrease the size of the font.
font color : This property is used to change the color of the text.
Example : CSS - Fonts
<!DOCTYPE html>
<html>
<head>
<style>
p {
font-weight : bold;
font-family: Impact, Charcoal, sans-serif;
font-size : 30px;
}
h3 {
color : blue;
}
div {
font-style : italic;
font-variant: normal;
}
</style>
</head>
<body>
<p>Code Always.</p>
<h3>Code Always To Become Best Programmer.</h3>
<div>
This is a text inside a div element.
So we can set a font for div element.
</div>
</body>
</html>
When the above code is compiled , it produces the following result.
Result
Code Always.
Code Always To Become Best Programmer.
This is a text inside a div element.
So we can set a font for div element.
You can set CSS Font properties inline, internal and external way of using CSS in your HTML page.