css 引入字体

css引入字体:

      我已经下载好字体,并且放在了font目录下

@font-face {
  font-family: 'Agency';   /*字体名称*/
  src: url('../font/AgencyFB.ttf');       /*字体源文件*/
}
.list_num{
	font-family: 'Agency';   /*字体名称,就是上面定义的名称*/
	font-size: 20px;
}

不同浏览器字体的格式有差别(这部分是我转载的)

字体后缀和浏览器有关,如下所示
* .TTF或.OTF,适用于Firefox 3.5、Safari、Opera 
* .EOT,适用于Internet Explorer 4.0+ 
* .SVG,适用于Chrome、IPhone 
比如:
@font-face {
    font-family: 'HansHandItalic';
    src: url('fonts/hanshand-webfont.eot');
    src: url('fonts/hanshand-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/hanshand-webfont.woff') format('woff'),
         url('fonts/hanshand-webfont.ttf') format('truetype'),
         url('fonts/hanshand-webfont.svg#webfont34M5alKg') format('svg');
    font-weight: normal;
    font-style: normal;
}

猜你喜欢

转载自blog.csdn.net/sunshinezx8023/article/details/81180516