HTML fonts code example

Example 1: css comic sans

font-family: "Comic Sans MS", "Comic Sans", cursive;

Example 2: font-style css

#example {
	font-style: normal; /* no specification, default */
  	font-style: italic; /* font is italic */
    font-style: oblique; /* font is italic, even if italic letters are not specified for font family */
    font-style: inherit; /* inherit property from parent */
	font-style: initial; /* default value */
}

Example 3: font family css

font-family: "Comic Sans MS", cursive, sans-serif;

Add More Fonts Here : - https://fonts.google.com/

Example 4: css font

@font-face {
  font-family: "Name of the font"; /*eg Ubuntu*/
  src: url("your/path/to/the.font");
}

p{
  font-family: "Ubuntu";
}

Example 5: use font on website html

<style type="text/css">
@font-face {
    font-family: "My Custom Font";
    src: url(http://www.example.org/mycustomfont.ttf) format("truetype");
}
p.customfont { 
    font-family: "My Custom Font", Verdana, Tahoma;
}
</style>
<p class="customfont">Hello world!</p>

Example 6: sans serif font family css

<style>
.sansserif {
font-family: Arial, Helvetica, sans-serif;
}
</style>

Tags:

Css Example