Html 将 Calibri (Body) 字体应用于文本
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10810176/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apply Calibri (Body) font to text
提问by Kichu
I have a div and in this div I want to display some text in Calibri (Body) font.
我有一个 div,在这个 div 中,我想用 Calibri (Body) 字体显示一些文本。
How can I do this?
我怎样才能做到这一点?
This is the css I have been given :
这是我得到的css:
.an_account_join_1 {
float:left;
width:100%;
color:#000000;
font-family:Calibri (Body);
letter-spacing:2px;
font-size:14px;
text-align:center;
margin:20px 0px;
}
This is the div:
这是div:
<div class="an_account_join_1">Individual Free Membership</div>
There is no font style displayed with this font family.
此字体系列没有显示字体样式。
When I look at the firebug output there is no style for font family.
当我查看萤火虫输出时,字体系列没有样式。
采纳答案by Dandy
If there is space between the letters of the font, you need to use quote.
如果字体的字母之间有空格,则需要使用quote。
font-family:"Calibri (Body)";
font-family:"Calibri (Body)";
回答by Jukka K. Korpela
There is no such font as “Calibri (Body)”. You probably saw this string in Microsoft Word font selection menu, but it's not a font name (see e.g. the explanation Font: +body (in W07)).
没有像“Calibri (Body)”这样的字体。您可能在 Microsoft Word 字体选择菜单中看到了这个字符串,但它不是字体名称(参见例如解释Font: +body (in W07))。
So use just font-family: Calibri
or, better, font-family: Calibri, sans-serif
. (There is no adequate backup font for Calibri, but the odds are that when Calibri is not available, the browser's default sans-serif font suits your design better than the browser's default font, which is most often a serif font.)
因此,仅使用font-family: Calibri
或更好地使用font-family: Calibri, sans-serif
. (Calibri 没有足够的备用字体,但很有可能当 Calibri 不可用时,浏览器的默认 sans-serif 字体比浏览器的默认字体更适合您的设计,而浏览器的默认字体通常是衬线字体。)