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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 01:49:53  来源:igfitidea点击:

How to use font-family lato?

cssfont-familygoogle-font-api

提问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;

link: http://www.google.com/fonts/specimen/Lato

链接:http: //www.google.com/fonts/specimen/Lato

回答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 .ttffont 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.rarthen go to TTF and open this font-face-generatorclick at Choose Filechoose font which you want to use and click at generate then download it and then go htmlfile 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' />