失眠网,内容丰富有趣,生活中的好帮手!
失眠网 > css引入外部自定义字体

css引入外部自定义字体

时间:2024-03-04 23:55:58

相关推荐

css引入外部自定义字体

首先在css文件中写入

@font-face {

font-family: '汉真广标',"SalesforceSansRegular";

src: url('../font/汉真广标2.ttf') ;

}

再在类中引入

.kc-name{

font-size: 18px;

color:red;

font-family: '汉真广标';

}

特殊字体别忘记考虑浏览器兼容性

字体后缀和浏览器有关,如下所示

* .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;

}

参考链接 :/qq_20757489/article/details/85059783

如果觉得《css引入外部自定义字体》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。