Add a font to a website

天涯浪子 提交于 2019-12-19 05:10:35

问题


I am trying to add this font : http://www.fonts2u.com/vps-dong-da-hoa.font

to my website. Here is my CSS :

@font-face {
font-family: "VPSDODAH";
src: url(http://localhost/blablabla/wp-content/plugins/buddypress/bp-themes/frisco-for-buddypress/VPSDODAH.ttf) format("truetype");}

#header h1 a {
font-family: "VPSDODAH";}

The URL to the font is correct but it's not working, what can it be ?

Thank you very much.


回答1:


Not all browser support .ttf. Use a font generator to get all the font types ( I use font2web ) and then just add the fonts via @font-face:

@font-face {
    font-family: 'fontName';
    src: url('../fonts/fontName.eot');
    src: url('../fonts/fontName.eot?iefix') format('eot'),
         url('../fonts/fontName.woff') format('woff'),
         url('../fonts/fontName.ttf') format('truetype'),
         url('../fonts/fontName.svg#fontName') format('svg');
    font-weight: normal;
    font-style: normal;
 }

Read here about browser font support.




回答2:


You can try this website for your web font generation. If your font exists, you can convert it and get all the @font-face parameters to apply it for your website.



来源:https://stackoverflow.com/questions/16541436/add-a-font-to-a-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!