CSS Fonts

Use this below code for set the fonts in html through CSS. Font Family, Font Style, Font Variant, Font Weight, Font Size and many more.

<!DOCTYPE html>
<html lang=“en”>
<head>

<meta charset=“utf-8”>
<style type=“text/css”>
.font_family{ font-family: Georgia, “Times New Roman”, Times, serif;  font-style:italic;  font-variant:small-caps}
.font_style{ font-style: italic;}
.font_variant{ font-variant: small-caps;}
.font_weight{ font-weight: bold;}
.font_size{ font-size: 28px;}
</style>

</head>
<body>

<h2> Font Family </h2>

<p class=“font_family”> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sagittis, justo eu maximus tempor, ante ex scelerisque sem, vel auctor velit </p>

<h2> Font Style </h2>

<p class=“font_style”> justo et nisl. Donec laoreet condimentum lorem nec facilisis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sagittis, justo eu maximus tempor, ante ex scelerisque sem, vel auctor velit </p>

<h2> Font Variant </h2>

<p class=“font_weight”> justo et nisl. Donec laoreet condimentum lorem nec facilisis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sagittis, justo eu maximus tempor, ante ex scelerisque sem, vel auctor velit </p>

<h2> Font Size </h2>

<p class=“font_size”> justo et nisl. Donec laoreet condimentum lorem nec facilisis. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc sagittis, justo eu maximus tempor, ante ex scelerisque sem, vel auctor velit </p>

</body>
</html>



Leave a Reply

avatar
  Subscribe  
Notify of