简体   繁体   English

用 CSS 理解字体(谷歌字体)

[英]Understanding Font with CSS (Google Fonts)

I am always struggling when it comes to the using fonts and their sizes.. I cannot get the desired style because I probably dont understand the CSS properties.. I would appreciate if someone can please clarify the following CSS codes..在使用字体及其大小时,我总是很挣扎.. 我无法获得所需的样式,因为我可能不了解 CSS 属性.. 如果有人可以澄清以下 CSS 代码,我将不胜感激..

@import url(http://fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700,700italic,900,900italic);

the above line is importing "Lato" font, but why so many options using COMMAS ?上面一行是导入“Lato”字体,但为什么有这么多选项使用 COMMAS ? and how can I use desired weight of font with above scenario..以及如何在上述情况下使用所需的字体重量..

font-weight: 300;
font-size:30px;

what actually is the font weight, isnt it making it for bold ?字体粗细实际上是多少,是不是使它变为粗体?

font: 700 10px/20px Helvetica;

What does this line means ?这条线是什么意思? why using a divider ?为什么要使用分隔线? 10px/20px ? 10 像素/20 像素?

I'll try to answer these as best I can.我会尽力回答这些问题。

  1. The commas are separating all of the various font weight and styles that you're importing.逗号分隔您要导入的所有各种字体粗细和样式。 The more you import, the higher your load times.导入的越多,加载时间越长。 It's best to only import the styles that you need.最好只导入您需要的样式。 You can select/deselect what you want on the actual Google Fonts site.您可以在实际的 Google 字体站点上选择/取消选择您想要的内容。
  2. The commas are separating all of the various font weight and styles that you're importing.逗号分隔您要导入的所有各种字体粗细和样式。 The more you import, the higher your load times.导入的越多,加载时间越长。 It's best to only import the styles that you need.最好只导入您需要的样式。 You can select/deselect what you want on the actual Google Fonts site.您可以在实际的 Google 字体站点上选择/取消选择您想要的内容。
  3. The '10px/20px' means 'FONTSIZE / LINEHEIGHT'. “10px/20px”表示“FONTSIZE / LINEHEIGHT”。 It lets you do both definitions in a single line.它允许您在一行中完成两个定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM