Arrow

CSS Font Family

AuthorHariom Prajapati

Pubish Date20 Aug 2022

categoryCSS

Font Family

Syntax - 

font-family: value;

  • The font-family specifies the font for an element.
  • The font family property hold several font name because if the browser does not support first font then it try to next font.
  • MustSeparate each value with a comma.

 

There are two types of font family name :-

family-name - The name of a font-family, like "times", "courier", "arial", etc.

generic-family - The name of a generic-family, like "serif", "sans-serif", "cursive", "fantasy", "monospace".

 

Note:- If font family name contain white space like Lucida Sans Unicode and need to write more then one font family name ,Then we must write it inside " " this.

 

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>background Origin</title>
	<style>
		h6 {
			font-family: Helvetica, sans-serif, serif;
			font-size: large;
		}
		h5 {
			font-family: 'Chilanka', cursive;
			font-size: large;
		}
	</style>
</head>

<body>
	<h6> technical sumit </h6>
	<h5> welcome to my website </h5>

</body>

</html>

 

Output

Font Family