Arrow

CSS Font Size

AuthorHariom Prajapati

Pubish Date20 Aug 2022

categoryCSS

It is use to set the size of the text (font).

 

Syntax - 

font-size: value;

 

values

medium

Sets the font-size to a medium size. This is default

xx-small Sets the font-size to an extra small size
x-small Sets the font-size to x- small size
small Sets the font-size to a small size
large 
Sets the font-size to a large size 
x-large 
Sets the font-size to x-large size
xx-large 
Sets the font-size to an extra large size
smaller
Sets the font-size to a smaller size
larger
Sets the font-size to a larger size
length
Sets the font-size to a fixed size in px, cm, em etc.
%
Sets the font-size in percent.

 

For example -

<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>Font Family</title>
	<style>
		h6 {
			font-size: 0.5em;
		}
		h4 {
			font-size: 20px;
		}
		h2 {
			font-size: xx-large;
		}
		h1 {
			font-size: 50%;
		}
	</style>
</head>

<body>
	<h6> Teknowize </h6>
	<h4> welcome to Teknowize </h4>
	<h2> welcome to Teknowize </h2>
	<h1> welcome to Teknowize </h1>
</body>

</html>

 

Output

Font Size