Reputation: 51
I want to load multiple @font-face in project @font-face in a main css file. I downloaded the files woff, but they are not loaded in web page. How to use font-face for local files?
@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";
}
Upvotes: 1
Views: 2030
Reputation: 2332
This solution is crossbrowser and works with local fonts:
@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");
}
You can add other fonts, but keep an eye on page loading time.
Upvotes: 1