CSS 如何使用 font-family lato?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21596760/
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
How to use font-family lato?
提问by user3274579
How to use font-family lato ?
如何使用 font-family lato ?
I have used style like this but not working . How can I do ? Thank you.
我使用过这样的风格,但没有用。我能怎么做 ?谢谢你。
font-family: Lato, Helvetica, sans-serif;
回答by Kumar
Please put this code in head section
请将此代码放在 head 部分
<link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>
and use font-family: 'Lato', sans-serif;
in your css. For example:
并font-family: 'Lato', sans-serif;
在您的 css 中使用。例如:
h1 {
font-family: 'Lato', sans-serif;
font-weight: 400;
}
Or you can use manually also
或者您也可以手动使用
Generate .ttf
font from fontSquiral
.ttf
从生成字体fontSquiral
and can try this option
并且可以试试这个选项
@font-face {
font-family: "Lato";
src: url('698242188-Lato-Bla.eot');
src: url('698242188-Lato-Bla.eot?#iefix') format('embedded-opentype'),
url('698242188-Lato-Bla.svg#Lato Black') format('svg'),
url('698242188-Lato-Bla.woff') format('woff'),
url('698242188-Lato-Bla.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
Called like this
这样叫
body {
font-family: 'Lato', sans-serif;
}
回答by user2727841
Download it from hereand extract LatoOFL.rar
then go to TTF and open this font-face-generatorclick at Choose File
choose font which you want to use and click at generate then download it and then go html
file open it and you see the code like this
从这里下载并解压缩LatoOFL.rar
然后转到 TTF 并打开此font-face-generator单击Choose File
选择要使用的字体并单击生成然后下载它然后去html
文件打开它你会看到这样的代码
@font-face {
font-family: "Lato Black";
src: url('698242188-Lato-Bla.eot');
src: url('698242188-Lato-Bla.eot?#iefix') format('embedded-opentype'),
url('698242188-Lato-Bla.svg#Lato Black') format('svg'),
url('698242188-Lato-Bla.woff') format('woff'),
url('698242188-Lato-Bla.ttf') format('truetype');
font-weight: normal;
font-style: normal;
}
body{
font-family: "Lato Black";
direction: ltr;
}
change the src code and give the url where your this font directory placed, now you can use it at your website...
更改 src 代码并提供放置此字体目录的 url,现在您可以在您的网站上使用它...
If you don't want to download it use this
如果你不想下载它使用这个
<link type='text/css' href='http://fonts.googleapis.com/css?family=Lato:400,700' />