FONTS IN HTML code example

Example 1: sans serif font family css

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

Example 2: 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 3: css font family

p{
    font-family:garamond,serif;
}

Example 4: font-family css

font-family: "Times New Roman", Georgia, serif;
/* If the browser does not support the first font (ie: Times New Roman),
it will then try the next font (ie: Georgia). The last font should always
be a "generic-family" font (ie: serif, sans-serif, etc..).
/* If font is more then one word, it must be put into quotes. */

Example 5: font tag html

Not Supported in HTML 5 | Support till HTML 4
<font color="red" face="Verdana, Geneva, sans-serif" size="+1">
  Your formatted text goes here
</font>

Example 6: font family css

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

Tags:

Css Example