tôi vừa mới có vấn đề này và nghĩ đến một giải pháp chỉ sau khi tôi đã vào trang này:
@import url(http://fonts.googleapis.com/css?family=Ubuntu:400,400italic,700,700italic);
@font-face {
font-family: "UbuntuFallback";
font-style: normal;
font-weight: normal;
src: url("/webfonts/ubuntu/ubuntu-webfont.eot?#iefix") format("embedded-opentype"), url("/webfonts/ubuntu/ubuntu-webfont.woff") format("woff"), url("/webfonts/ubuntu/ubuntu-webfont.ttf") format("truetype");
}
@font-face {
font-family: "UbuntuFallback";
font-style: normal;
font-weight: bold;
src: url("/webfonts/ubuntu/ubuntu-bold-webfont.eot?#iefix") format("embedded-opentype"), url("/webfonts/ubuntu/ubuntu-bold-webfont.woff") format("woff"), url("/webfonts/ubuntu/ubuntu-bold-webfont.ttf") format("truetype");
}
@font-face {
font-family: "UbuntuFallback";
font-style: italic;
font-weight: normal;
src: url("/webfonts/ubuntu/ubuntu-italic-webfont.eot?#iefix") format("embedded-opentype"), url("/webfonts/ubuntu/ubuntu-italic-webfont.woff") format("woff"), url("/webfonts/ubuntu/ubuntu-italic-webfont.ttf") format("truetype");
}
@font-face {
font-family: "UbuntuFallback";
font-style: italic;
font-weight: bold;
src: url("/webfonts/ubuntu/ubuntu-bolditalic-webfont.eot?#iefix") format("embedded-opentype"), url("/webfonts/ubuntu/ubuntu-bolditalic-webfont.woff") format("woff"), url("/webfonts/ubuntu/ubuntu-bolditalic-webfont.ttf") format("truetype");
}
body
{
font-family: Ubuntu, UbuntuFallback, Tahoma, Sans-Serif;
}
Vì vậy, tôi muốn sử dụng phông chữ Ubuntu, tuy nhiên website của chúng tôi được chạy trên một localhost và chiến thắng' t nhất thiết phải được kết nối với internet. Tôi đã tạo một số khai báo phông chữ @ cho phông chữ Ubuntu, được gọi là một cái gì đó khác ("UbuntuFallback") và chỉ cần đặt nó trong danh sách kiểu phông chữ gia đình.
Voilá!
Nguồn
2014-03-05 11:50:12
Cảm ơn bạn rất nhiều - lạ làm thế nào tôi không thể thấy điều này, mặc dù nó rất rõ ràng và thanh lịch.. :) –