2014-05-19 24 views

回答

1

把你的CSS文件中的,例如example.css:

@font-face { 
    font-family: "customfont"; 
    src: url("./fonts/arial.ttf") format("opentype"); 
     /* Make sure you defined the correct path, which is related to 
      the location of your file `example.css` */ 
    } 
    body { 
     font-family: "customfont"; 
     font-size:30px; 
    } 

- 参考你的HTML CSS文件example.css:

<link rel="stylesheet" href="./css/example.css" /> 

请务必遵循正确的目录结构

例如,假设您有以下目录结构:

WWW

  • example.html的

CSS

  • example.css

字体

  • arial.ttf