How do I add custom fonts?
This question already has an answer here:
download your font and put in any directory. here i added in fonts directory
<style>
@font-face {
font-family: 'maven_pro_light_300regular';
src: url('fonts/mavenprolight-300-webfont.eot');
src: url('fonts/mavenprolight-300-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/mavenprolight-300-webfont.ttf') format('truetype'),
url('fonts/mavenprolight-300-webfont.woff') format('woff'),
url('fonts/mavenprolight-300-webfont.svg#maven_pro_light_300regular') format('svg');
font-weight: normal;
font-style: normal;
}
</style>
and you can use it by follow example:
<style>
h2{
font-family:maven_pro_light_300regular;
}
</style>
.my-font{ font-family: font name; }
这是css代码。
Using CSS3 you can make reference to a font file for use on the HTML page. Here is some code:
<style>
@font-face
{
font-family: myFirstFont;
src: url(fontFILE.woff);
}
div
{
font-family:myFirstFont;
}
</style>
The location of the file would be added in place of "fontFILE". You would just upload the font file along with the HTML page.
Here is a W3Schools article about this: here
链接地址: http://www.djcxy.com/p/87438.html下一篇: 我如何添加自定义字体?