We can use @font-face to add font to web page and don't need to depend on the "web-safe" fonts.
@font-face { font-family: myFirstFont; src: url(sansation_light.woff); } div { font-family: myFirstFont; }
TTF/OTF fonts |
Yes | Yes | Yes | Yes | Yes |
WOFF fonts |
Yes | Yes | Yes | Yes | Yes |
This example simply specifies a downloadable font to use, applying it to the entire body of the document.
<html>
<head>
<title>Web Font Sample</title>
<style type="text/css" media="screen, print">
@font-face {
font-family: "Bitstream Vera Serif Bold";
src: url("https://mdn.mozillademos.org/files/2468/VeraSeBd.ttf");
}<!--from w w w . j a v a2 s .com-->
body { font-family: "Bitstream Vera Serif Bold", serif }
</style>
</head>
<body>
This is Bitstream Vera Serif Bold.
</body>
</html>