FONTFACE CSS code example
Example 1: how many fonts can i add in a css font-face
@font-face {
font-family: CustomFont;
src: url('CustomFont.ttf');
}
@font-face {
font-family: CustomFont2;
src: url('CustomFont2.ttf');
}
Example 2: css font face
@font-face {
font-family: thisSpecialFont;
src: url(linkToFontFile.woff);
}
body {
font-family: thisSpecialFont;
}
Example 3: @font-face rule in css
@font-face {
font-family: "Open Sans";
src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
url("/fonts/OpenSans-Regular-webfont.woff") format("woff");
}
Example 4: css font
@font-face {
font-family: "Name of the font";
src: url("your/path/to/the.font");
}
p{
font-family: "Ubuntu";
}
Example 5: @fontface css
@font-face {
font-family: 'MyWebFont';
src: url('webfont.eot');
src: url('webfont.eot?#iefix') format('embedded-opentype'),
url('webfont.woff2') format('woff2'),
url('webfont.woff') format('woff'),
url('webfont.ttf') format('truetype'),
url('webfont.svg#svgFontName') format('svg');
}
Example 6: font face html
@font-face { font-family: 'meine-schrift';
src: url('pfad/zu/meinerschrift.ttf') format('truetype'); }