我想在一个主css文件中加载多个@font-face项目@font-face。我下载了woff文件,但它们没有加载到网页中。如何在本地文件中使用font-face?
@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 400;
src: url('../Fonts/font1.woff');
src: local('☺'),
url('font1.woff') format('woff');
}
@font-face {
font-family: 'Ubuntu';
font-style: normal;
font-weight: 700;
src: "../Fonts/font2.woff";
}发布于 2013-02-27 16:25:25
此解决方案是跨浏览器的,可与本地字体一起使用:
@font-face {
font-family: "Exo";
font-style: normal;
font-weight: 400;
src: url("/font/exo/Exo-Regular-webfont.eot?#iefix") format("embedded-opentype"),
url("/font/exo/Exo-Regular-webfont.woff") format("woff"),
url("/font/exo/Exo-Regular-webfont.ttf") format("truetype"),
url("/font/exo/Exo-Regular-webfont.eot"), local("Exo-Regular"),
url("/font/exo/Exo-Regular-webfont.svg#ExoRegular") format("svg");
}
@font-face {
font-family: "Exo";
font-style: normal;
font-weight: 700;
src: url("/font/exo/Exo-DemiBold-webfont.eot?#iefix") format("embedded-opentype"),
url("/font/exo/Exo-DemiBold-webfont.woff") format("woff"),
url("/font/exo/Exo-DemiBold-webfont.ttf") format("truetype"),
url("/font/exo/Exo-DemiBold-webfont.eot"), local("Exo-Bold"),
url("/font/exo/Exo-DemiBold-webfont.svg#ExoDemiBold") format("svg");
}您可以添加其他字体,但要注意页面加载时间。
https://stackoverflow.com/questions/15107209
复制相似问题