css 字体字体图标_CSS基础知识:了解字体

css 字体字体图标

In this tutorial, we’ll be learning about working with fonts in CSS!

在本教程中,我们将学习有关在CSS中使用字体的知识!

The font property is a shorthand property which can combine a number of sub-properties in a single declaration. For example:

font属性是一种简写属性,可以在单个声明中组合多个子属性。 例如:

font: 

This is equivalent to:

这等效于:

font-stretch: normal;
font-style: italic;
font-variant: small-caps;
font-weight: bold;
font-size: 16px;
line-height: 120%;
font-family: "

Let’s review each of these properties in detail!

让我们详细检查每个属性!

Are you ready to take your CSS skills to the next level? Get started now with my new course at Educative.io SASS for CSS: Advanced Frontend Development. Get up-to-date on all the features you need to advance your front end development skills!

您准备好将CSS技能提高到一个新水平吗? 现在就开始使用Educative.io SASSCSS新课程:高级前端开发 。 获取有关提高前端开发技能所需的所有功能的最新信息!

CSS字体属性 (CSS Font properties)

font-family (font-family)

The font-family property sets the font family that the element will use.

font-family属性设置元素将使用的字体系列

The selected font is not a single font face but one of a “family”, as a font is composed of a number of sub-fonts. Such as bold, italic, light, etc.

所选字体不是单个字体,而是“族”之一,因为字体由许多子字体组成。 例如粗体,斜体,浅色等。

body {
font-family: Helvetica;
}

The font family name matches either a font that is embedded on the page or available on the user’s system.

字体系列名称与页面上嵌入的字体或用户系统上可用的字体匹配。

We could also choose multiple fonts like so:

我们还可以选择多种字体,如下所示:

body {
font-family: Helvetica, Arial, sans-serif;
}

In this case, the browser will choose the next font, if the first cannot be used. This might happen if it’s either not found on the users local machine, or if the server that the font is hosted in is down.

在这种情况下,如果无法使用第一个字体,浏览器将选择下一个字体。 如果在用户本地计算机上找不到该字体,或者托管该字体的服务器已关闭,则可能会发生这种情况。

Font types are typically classified as Serif, Sans-Serif, or Monospace fonts. Here’s some of most popular:

字体类型通常分为Serif,Sans-Serif或Monospace字体。 以下是一些最受欢迎的内容:

Serif: Georgia, Times New Roman

衬线:佐治亚州,时代新罗马

Sans-Serif: Arial, Helvetica, Verdana, Lucida Grande , Trebuchet MS

Sans-Serif: Arial,Helvetica,Verdana,Lucida Grande和Trebuchet MS

Monospace: Courier, Courier New, Lucida Console

Monospace: Courier,Courier New,Lucida Console

line-height (line-height)

The line-height property sets the amount of space above and below our element.

line-height属性设置元素上方和下方的空间量。

p {
line-height: 1.5;
}

We can also use the keyword values normal,none as well as a number, length (any valid CSS unit), or percentage (being the elements’ font size multiplied by the %).

我们还可以使用关键字值normalnone以及数字,长度(任何有效的CSS单位 )或百分比(即元素的字体大小乘以%)。

font-weight (font-weight)

The font-weight property sets the width (or thickness) of each of the characters of a font. You can use the following values:

font-weight属性设置font-weight的每个字符的宽度(或粗细)。 您可以使用以下值:

  • normal

    normal

  • bold

    bold

  • bolder

    bolder

  • lighter

    lighter

Note that bolder & lighter are relative to the elements’ parent.

请注意, bolderlighter体相对于元素的父级。

Numeric values can also be used:

也可以使用数值:

  • 100

    100

  • 200

    200

  • 300

    300

  • 400 (equivalent to normal)

    400 (相当于normal )

  • 500

    500

  • 600

    600

  • 700 (equivalent to bold)

    700 (相当于bold )

  • 800

    800

  • 900

    900

With 100 being the lightest font, and 900 the boldest.

100是最轻的字体,而900是最粗体。

For values other than 400 or 700 to have an effect, the font being used must have built-in faces that match these weights.

为使400700以外的值生效,所使用的字体必须具有与这些权重匹配的内置字体。

font-stretch (font-stretch)

With font-stretch we can choose a narrow or wide face of the font. Assuming the font being used contains corresponding font faces.

使用font-stretch我们可以选择font-stretch的窄或宽。 假设所使用的字体包含相应的字体。

The possible values are:

可能的值为:

  • ultra-condensed

    ultra-condensed

  • extra-condensed

    extra-condensed

  • condensed

    condensed

  • semi-condensed

    semi-condensed

  • normal

    normal

  • semi-expanded

    semi-expanded

  • expanded

    expanded

  • extra-expanded

    extra-expanded

  • ultra-expanded

    ultra-expanded

font-style (font-style)

The font-style property accepts one of three possible values: normal, italic, and oblique.

font-style属性接受三个可能值之一: normalitalicoblique

For example, to set our font to italic:

例如,将字体设置为斜体:

p {
font-style: italic;
}

There is very little difference between using italic and oblique. Both apply a sloping effect to text.

有使用差别很小是italicoblique 。 两者都对文本施加倾斜效果。

font-size (font-size)

The font-size property is used to determine the size of fonts. For example:

font-size属性用于确定字体的大小。 例如:

p {
font-size: 20px;
}

You either use a valid length value (such as px, em, rem a percentage, etc), or a predefined value keyword.

您可以使用有效的长度值(例如pxemrem a rem等),也可以使用预定义的value关键字。

The available keyword values are:

可用的关键字值为:

  • xx-small

    xx-small

  • x-small

    x-small

  • small

    small

  • medium

    medium

  • large

    large

  • x-large

    x-large

  • xx-large

    xx-large

  • smaller

    smaller

  • larger

    larger

With both smaller & larger being relative to the parent element.

相对于父元素而言,都larger smaller

Note that font-size is a mandatory value. When using the font shorthand property, the size must be set (or it will be invalid)!

请注意, font-size是必填值。 使用font简写属性时,必须设置大小(否则将无效)!

font-variant (font-variant)

The font-variant property is a bit of a relic. It was originally used to set text to small caps, it had 3 values:

font-variant属性有点遗迹。 它最初用于将文本设置为小写,它具有3个值:

  • normal

    normal

  • inherit

    inherit

  • small-caps

    small-caps

Small caps sets the text to “smaller caps”, that is smaller than the regular uppercase letters.

小写大写将文本设置为“小写大写”,小于常规的大写字母。

I just wanted to mention that 🎉 I’ve started my own blog! 🎉 Check it out at www.easeout.co

我只想提及🎉我已经开始了自己的博客 ! at在www.easeout.co上查看

I also have a newsletter, if you’d like to keep up!

如果您想跟上我的消息,我也有一份通讯 !

I post frequently about web design & development, however as always I’ll be continuing to post my development tutorials here on Medium.

我经常发布有关Web设计和开发的文章,但是与往常一样,我将继续在Medium上发布我的开发教程。

Thanks for reading!

谢谢阅读!

翻译自: https://itnext.io/css-fundamentals-understanding-fonts-82e9930528fa

css 字体字体图标

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/274293.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

openstack quantum搭建过程中一些有用的链接

OpenvSwitch的概念和流程: http://blog.wachang.net/2013/03/openvswitch-fullbook-2-workflow-1/ OpenvSwitch的vlan模式: http://openvswitch.org/support/config-cookbooks/vlan-configuration-cookbook/ OpenvSwitch问答: http://openvsw…

mysql下载哪一代版本好_潮一代更好的设计

mysql下载哪一代版本好I think we can all agree that quarantined life has been strange. And while most of the day is comprised of the monotony of domestic life, I’ve been surprised at how much of my time is dominated by technology.我认为我们都可以同意隔离的…

预约清单ui设计_持续交付质量设计所需的UI清单

预约清单ui设计重点 (Top highlight)Over the past few months, my design team at StreetEasy has started experimenting in adding a “design buddy” check-in to the final stages of the design process.在过去的几个月中,我在StreetEasy的设计团队已开始尝试…

黑书上的DP例题

pagesectionnotitlesubmit1131.5.1例题1括号序列POJ11411161.5.1例题2棋盘分割POJ11911171.5.1例题3决斗Sicily18221171.5.1例题4“舞蹈家”怀特先生ACM-ICPC Live Archive1191.5.1例题5积木游戏http://202.120.80.191/problem.php?problemid12441231.5.2例题1方块消除http://…

静态创意和动态创意_我在22岁时学到的关于创意指导的知识

静态创意和动态创意During my last semester at college, I took a course titled “Collaborative Workshop”. The entire course focused on how to best collaborate within a team setting. We were placed into groups of 4 or 5. These were our “creative director” …

vim7.1在windows下的编码设置[转]

在gvm配置文件中: (gvim安装目录下的_vimrc文件中) """""""""""""""""""""""""""""&…

绝对编码和增量编码_用户体验设计师应该学习编码吗? 绝对

绝对编码和增量编码Even though I was trained as a graphic designer, I’ve never limited myself to that field exclusively. My particular interest in how things work didn’t allow me to stand still and as a young kid, I was already pulling apart all my toys t…

两个ID

在itpub上注册了ID googlgoracle ,发过不少的求助帖子。 http://www.itpub.net/home.php?modspace&dothread&viewme 在CSDN 上ID:googlg,注册时间挺早的2008年,一直也没有弄过。 http://write.blog.csdn.net/postlist http://blog.csdn.net/goo…

完美主义怎么解决_相信我,你不要完美主义

完美主义怎么解决Perfectionism to UXers is like a badge of honour. We pride ourselves on the attention to detail and the drive to constantly push our work to the next level. When I asked some of my clients who share this sentiment about perfectionism, they …

MDK linker和debug的设置以及在RAM中调试

有误或者表述不清楚请指出,谢谢 硬件:TQ2440开发板、jlink V8 固件 软件:J-LINK ARM 4.08i、MDK4.20 先解释下MDK中三种linker之间的区别 设置集中在option linker选项卡 1.采用Target对话框中的ram和rom地址。采用此方式,…

FS_S5PC100 UBOOT-2011.12移植,支持DM9000

在uboot中已经支持了DM9000驱动代码在drivers/net/目录下的dm9000x.c dm9000x.h 修改include/configs/smdkc100.h 文件,注释掉SMC911X的支持,添加对DM9000的支持//#define CONFIG_SMC911X 1 /* we have a SMC9115 on-board *///#define…

为什么ui框架设计成单线程_评估UI设计的备忘单

为什么ui框架设计成单线程Whether you’re evaluating your design proposals or giving feedback to a colleague during a design critique or an informal conversation, you may find this actionable cheat sheet valuable. It’s quick to digest and its questions are …

css 菜单栏悬停_在CSS中构建悬停菜单

css 菜单栏悬停A good menu design is an important part of any website or web app UI. Using only modern HTML and CSS, all kinds of menu combinations can be created to handle whatever user interactions are necessary. In this article, we’ll take a look at how…

一级学科和二级学科_在多学科团队中工作的6个障碍(以及如何解决这些问题)

一级学科和二级学科In a team with different skillsets, one can be hopeful and idealistic about the outcome. The goal is to work as one team, put users first and create awesome experiences. Unfortunately, things don’t always go as planned.在一支具有不同技能…

LBS核心技术解析(引子)

http://www.cnblogs.com/LBSer/archive/2013/04/25/3048754.html 引子: 人们常用“上知天文,下知地理”来形容一个人的博学,人们总是用三要素论“什么时间、什么地点,发生或干了什么事情”来描述一件事情,人们也常常借用“天时、地…

lynda ux_如何建立内部UX团队

lynda uxWritten by Cassandra Naji由卡珊德拉纳吉 ( Cassandra Naji)撰写 The needs of real users are increasingly driving enterprise software design and development. Since 2013, IBM has hired close to 1500 designers and UXers, establishing the largest design…

IE6下div宽高设置

IE6下宽高设置。IE下div 中没有内容时,设置宽高不起作用,必须设置div背景色,并使用滤镜。才能使Div填充目标区域。多用于,其他容器元素使用背景图片,但是背景图片的部分需要其他的事件支持。如跳转。可以使用放置div的…

财务软件开发_财务独立对软件开发人员的重要性

财务软件开发If you read this post, chances that you are a software developer who is seeking financial advice for smart money-saving or investment or early retirement.如果您阅读此文章,则您很可能是一名软件开发人员,正在为精明的省钱或投资…

WIP模块常用表结构

WIP模块常用表结构表名: wip.wip_accounting_classes说明: 离散作业会计科目CLASS_CODE VARCHAR2(10) 帐目ORGANIZATION_ID NUMBER 组织代码CLASS_TYPE NUMBER 帐目类型DESCRIPTION VARCHAR2(240) 描述…

book电子书数据库设计_如何为杀手book的封面设计写出完美的摘要

book电子书数据库设计逐步出版真正的假人 (BOOK PUBLISHING STEP BY STEP FOR REAL DUMMIES) I have spent 18 years in advertising, briefing designers and art directors on various projects — from the simplest typo-only banners to the most complex integrated camp…