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.pswp.cn/news/274293.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274293.shtml
英文地址,請注明出處:http://en.pswp.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…