welcome to tutorialfamily

css font

css font used for applying different type of font to element.

Font like “times new roman”,”helventica”,”sans-serif”,”serif”.


css font

  • font-family – syntax of font
  • font-size – size of font
  • font-style – style of font
  • font-weight – weight of font
  • background-position – Used for a background-position

css font


						        
<!DOCTYPE html>
<html>
<head>
   <title>css tutorial</title>
<style>
h1{
   font-family: "Times New Roman", sans-serif;
   color: red;
   font-size: 40px;
   font-style: normal;
   font-weight:bold;
}
h2{
   font-family: "Times New Roman", serif;
   color: green;
   font-size: 30px;
   font-style: italic;
   font-weight:bold;
}
</style>
</head>
<body>
   <h1>my car</h1>
   <h2>my bike</h2>
</body>
</html>


Run

css font all property in single line


						        
<!DOCTYPE html>
<html>
<head>
   <title>css tutorial</title>
<style>
h1{
   font: 30px/40px "Times New Roman", sans-serif;
   color: red;
}
h2{
   font: italic bold 20px/30px "Times New Roman", sans-serif;
   color: red;
}
</style>
</head>
<body>
   <h1>my car</h1>
   <h2>my bike</h2>
</body>
</html>


Run

Our Content