css系统自带字体

  • A little bit of history

    一点历史

  • Today

    今天

  • The impact of Web Fonts

    网络字体的影响

  • Enter System Fonts

    输入系统字体

  • Popular websites use System Fonts

    热门网站使用系统字体

  • I’m sold. Give me the code

    我卖了 给我密码

    • A note on system-ui

      关于system-ui

    I’m sold. Give me the code

    我卖了 给我密码

  • Use font variations by creating @font-face rules

    通过创建@ font-face规则使用字体变体

  • Read more

一点历史 (A little bit of history)

For years, websites could only use fonts available on all computers, such as Georgia, Verdana, Arial, Helvetica, Times New Roman. Other fonts were not guaranteed to work on all websites.

多年来 ,网站只能使用所有计算机上可用的字体,例如格鲁吉亚,韦尔达纳,Arial,Helvetica,Times New Roman。 不能保证其他字体在所有网站上都可以使用。

If you wanted to use a fancy font you had to use images.

如果要使用精美字体,则必须使用图像。

In 2008 Safari and Firefox introduced the @font-face CSS property, and online services started to provide licenses to Web Fonts. The first was Typekit in 2009, and later Google Fonts got hugely popular thanks to its free offering.

在2008年,Safari和Firefox引入了@font-face CSS属性,并且在线服务开始为Web字体提供许可证。 首先是2009年的Typekit,后来由于免费提供了Google字体,因此受到了极大的欢迎。

@font-face was implemented in all the major browsers, and nowadays it’s a given on every reasonably recent device. If you’re a young web developer you might not realize it, but in 2012 we still had articles explaining this new technology of Web Fonts.

@font-face已在所有主流浏览器中实现,如今,它已在所有合理的最新设备上使用。 如果您是一个年轻的Web开发人员,您可能没有意识到,但是在2012年,我们仍然有文章介绍这种Web字体新技术。

今天 (Today)

You can use whatever font you wish to use, by relying on a service like Google Fonts, or providing your own font to download.

可以依靠Google字体之类的服务来使用想要使用的任何字体,也可以提供自己的字体进行下载。

You can, but should you?

可以 ,但是应该吗

If you have the choice (and by this I mean, you’re not implementing a design that a client gave you), you might want to think about it, in a move to go back to the basics (but in style!)

如果您可以选择(并且这意味着您没有实现客户给您的设计),则可能需要考虑一下,然后再回到基础知识(但要有风格!)。

网络字体的影响 (The impact of Web Fonts)

Everything you load on your pages has a cost. This cost is especially impactful on mobile, where every byte you require is impacting the load time, and the amount of bandwidth you make your users consume.

您在页面上加载的所有内容都需要付费 。 此成本对移动设备特别重要,因为移动设备上所需的每个字节都会影响加载时间以及用户占用的带宽量。

The font must load before the content renders, so you need to wait for that resource loading to complete before the user is able to read even a single word you wrote.

字体必须在内容呈现之前加载,因此您需要等待资源加载完成,才能使用户甚至可以读取您编写的单个单词。

But Web Fonts are a way to provide an awesome user experience through good typography.

但是,Web字体是一种通过良好的排版提供令人敬畏的用户体验的方法

输入系统字体 (Enter System Fonts)

Operating Systems have great default fonts.

操作系统具有出色的默认字体。

System Fonts offer the great advantage of speed and performance, and a reduction of your web page size.

系统字体提供了速度性能的极大优势,并减小了网页大小

But as a side effect, they make your website look very familiar to anyone looking at it, because they are used to see that same font every day on their computer or mobile device.

但是,副作用是,它们使您的网站看上去对任何浏览它的人都很熟悉 ,因为它们习惯于每天在计算机或移动设备上看到相同的字体。

It’s effectively a native font.

它实际上是一种本地字体

And as it’s the system font, it’s guaranteed to look great.

并且由于它是系统字体,因此可以保证外观很棒

热门网站使用系统字体 (Popular websites use System Fonts)

You might know one of these, as an example:

您可能知道其中之一,例如:

  • GitHub的GitHub
  • Medium中
  • Ghost鬼
  • Bootstrap引导程序
  • Booking.comBooking.com

..they have been using System Fonts for years.

..他们已经使用系统字体多年了。

Even the Wordpress dashboard - that runs millions of websites - uses system fonts, and Medium, which is all about reading, decided to use system fonts.

甚至运行数百万个网站的Wordpress仪表板也使用系统字体,而与阅读有关的Medium决定使用系统字体。

If it works for them, chances are it works for you as well.

如果对他们有用,那么它也很可能对您也有用。

我卖了 给我密码 (I’m sold. Give me the code)

This is the CSS line you should add to your website:

这是您应该添加到网站CSS行:

body {font-family: -apple-system, BlinkMacSystemFont, "Segoe UI","Roboto", "Oxygen", "Ubuntu", "Helvetica Neue", Arial, sans-serif;
}

The browser will interpret all these font names, and starting from the first it will check if it’s available.

浏览器将解释所有这些字体名称,并从第一个字体开始检查它是​​否可用。

Safari and Firefox on macOS “intercept” -apple-system, which means the San Francisco font on newer versions, Helvetica Neue and Lucida Grande on older versions.

macOS上的Safari和Firefox是“ intercept” -apple-system ,这意味着较新版本的San Francisco字体,较旧版本的Helvetica Neue和Lucida Grande。

Chrome works with BlinkMacSystemFont, which defaults to the OS font (again, San Francisco on macOS).

Chrome与BlinkMacSystemFont一起使用,该默认设置为OS字体(再次在macOS上为San Francisco)。

Segoe UI is used in modern Windows systems and Windows Phone, Tahoma in Windows XP, Roboto in Android, and so on targeting other platforms.

Segoe UI用于现代Windows系统和Windows Phone,Windows XP中的Tahoma,Android中的Roboto等,以其他平台为目标。

Arial and sans-serif are the fallback fonts.

Arial和sans-serif是后备字体。

If you use Emojis in your site, make sure you load the symbol fonts as well:

如果您在网站中使用表情符号 ,请确保同时加载符号字体:

body {font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto","Oxygen", "Ubuntu", "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji","Segoe UI Emoji", "Segoe UI Symbol";
}

You might want to change the order of the font appearance based on your website usage statistics.

您可能需要根据网站使用情况统计信息更改字体外观的顺序。

关于system-ui (A note on system-ui)

Maybe you will see system-ui mentioned in System Fonts posts online, but at the moment it’s known to cause issues in Windows (see https://infinnie.github.io/blog/2017/systemui.html and https://github.com/twbs/bootstrap/pull/22377)

也许您会在线上看到system-ui字体发布中提到的system-ui ,但目前已知它会在Windows中引起问题(请参见https://infinnie.github.io/blog/2017/systemui.html和https:// github .com / twbs / bootstrap / pull / 22377 )

There is work being done towards standardizing system-ui as a generic font family, so in the future you will just write

目前正在努力将system-ui标准化为通用字体系列,因此将来您将只编写

body {font-family: system-ui;
}

See https://www.chromestatus.com/feature/5640395337760768 and https://caniuse.com/#feat=font-family-system-ui to keep an eye on the progress. Chrome, Safari already support it, Firefox partially, while Edge does not yet implement it.

请参阅https://www.chromestatus.com/feature/5640395337760768和https://caniuse.com/#feat=font-family-system-ui以了解进度。 Chrome,Safari已支持它,Firefox已部分支持,而Edge尚未实现。

通过创建@ font-face规则使用字体变体 (Use font variations by creating @font-face rules)

The approach described above works great until you need to alter the font on a second element, and maybe even on more than one.

在您需要更改第二个元素(甚至可能多个元素)上的字体之前,上述方法非常有效

Maybe you want to specify the italic as a font property rather than in font-style, or set a specific font weight.

也许您想将斜体指定为font属性,而不是font-style ,或者设置特定的字体粗细。

This nice project by Jonathan Neal https://jonathantneal.github.io/system-font-css/ lets you use System Fonts by importing a module, and you can set

Jonathan Neal的这个不错的项目https://jonathantneal.github.io/system-font-css/允许您通过导入模块来使用系统字体,并且可以设置

body {font-family: system-ui;
}

This system-ui is defined in https://github.com/jonathantneal/system-font-css/blob/gh-pages/system-font.css.

system-ui在https://github.com/jonathantneal/system-font-css/blob/gh-pages/system-font.css中定义。

You are now able to use different font variations by referencing:

现在,您可以通过引用使用不同的字体变体:

.special-text {font: italic 300 system-ui;
}p {font: 400 system-ui;
}

(Read more)

  • https://css-tricks.com/snippets/css/system-font-stack/

    https://css-tricks.com/snippets/css/system-font-stack/

  • https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/

    https://www.smashingmagazine.com/2015/11/using-system-ui-fonts-practical-guide/

  • https://medium.design/system-shock-6b1dc6d6596f

    https://medium.design/system-shock-6b1dc6d6596f

翻译自: https://flaviocopes.com/css-system-fonts/

css系统自带字体

css系统自带字体_CSS系统字体相关推荐

  1. css系统自带字体_CSS系统字体堆栈参考

    css系统自带字体 Fonts on a website can easily become a large part of the total bundle size that browsers h ...

  2. linux系统自带python_Linux删除系统自带版本Python过程详解

    巨坑,切忌不要轻易删除linux系统自带版本的python 1.卸载python(防止未卸载干净) rpm -qa|grep python|xargs rpm -ev --allmatches --n ...

  3. oracle数据库中的系统自带表情_oracle 系统自带几个常用函数

    今天给各位刚入门的oracle sql的朋友说一些系统自带的常用函数,通过函数来实现某些效果会非常的省事便捷,函数可以用在适当的dml语句和查询语句中. 我们今天所有的示例都为scott模式下的emp ...

  4. linux显示 cron 服务是否正在运行_通过Linux系统自带日志监控系统安全

    引 言 如今绝大多数网络监控运维服务系统都是基于Linux操作系统开发的,作为一款网络安全检测防护设备,其本身的安全防护也是需要关注的重要环节之一.而几乎所有需要分析的信息均来源于各种日志,日志对于安 ...

  5. 直播带货系统,带货直播系统中发布商品的逻辑处理流程

    直播带货系统的风潮最近突然就刮了起来,这大概要归功于淘宝直播带货达人"李佳琦".作为优质的直播系统开发商,为了能给众多用户带来实用性强且变现方式多元化的直播产品体验,推出了带货直播 ...

  6. 开启 Win10 系统自带的 Ubuntu 系统

    Ubuntu 是 Linux 的一个发行版本,Linux 的强大不多说了.如今的时代离不开网络,一切跟网络有关的服务,背后是成千上万台 Linux 服务器每时每刻运行着,以提供支持. 一般我们使用 U ...

  7. Windows 10通过系统自带工具进行系统备份及恢复方法

    一.系统备份: [1]打开"控制面板",点击"系统和安全" [2]点击"文件历史记录" [3]点击左下角"系统映像备份" ...

  8. 带评论的php文章系统,启用Typecho原生评论系统替代多说

    2017年6月1日起,多说(duoshuo.com)社会化评论系统正式停止提供服务.拾肆自从转入Typecho以来一直未启用系统自带的评论系统,而使用了多说的评论系统. 采用多说可以不限于单独一个站点 ...

  9. mac系统学python_升级mac自带的python,学python拿mac还是win,使用系统自带Pyth

    升级mac自带的python,学python拿mac还是win,使用系统自带Pyth 使用系统自带Python的弊端 系统自带的python版本比较旧,得不到python开发社区的支持,系统版本pyt ...

  10. ubuntu vscode 终端字体设置(字体间隔过大)

    ubuntu vscode 终端字体设置(字体间隔过大) 1 问题 2 原因 3 处理 3.1 查看系统字体 3.2 设置系统预置字体 3.3 设置自定义字体 1 问题 ubuntu 18.04 系统 ...

最新文章

  1. 1台电脑,3个月,没有任何数据支撑!我做出了行业一线标准的识别应用
  2. 阿里云VGN5i虚拟化GPU服务器价格更低的GPU计算服务
  3. 国家计算机科学进展,高等学校计算机一级学科教学改革与科学办学最新进展.pdf...
  4. 【线上分享】华为云视频的Cloud Native实践
  5. 2014-11-25nbsp;11:26
  6. 【渝粤题库】广东开放大学 Java高级编程技术 形成性考核
  7. matlab中基于十字形窗口的滤波算法,#215;字形滤波窗口在Matlab自适应中值滤波算法中的应用 - 21ic中国电子网...
  8. linux中的权限管理,Linux中的用户和权限管理
  9. 开发日记:接口开发设计
  10. RBAC-基于角色的权限管理
  11. 一种支持多种流媒体协议的播放内核
  12. 管理信息系统复习总结(保姆级)
  13. 安装win32com
  14. 今日头条算法及技术架构分析
  15. 创业者防坑手册:面对强大的资本力量,你该如何正当防卫?
  16. 2021年最全的自动化测试面试题及答案--看完后吊打面试官!自动化测试是什么?自动化测试学什么?
  17. Interledger协议(ILP)
  18. apt-get update 出错 Could not connect to archive.ubuntukylin.com:10006 (120.240.95.35), connection tim
  19. binlog事件类型详解
  20. 微型计算机的字符信息编码方案,微型计算机中普遍采用的字符信息编码方案是(.doc...

热门文章

  1. 网页中常用加载页面的实现原理
  2. html5做开心消消乐源代码,HTML5手机端开心消消乐源码
  3. ncbi查找目的基因序列_如何使用 NCBI 查找基因序列、mRNA、Promoter
  4. 企业架构 | TOGAF内容框架
  5. Android 银行账号
  6. 微软商店点下载没反应
  7. JDBC原生连接与连接池介绍
  8. 封装自己专属的真正的纯净版Windows系统过程记录(4)——进行封装
  9. 在线检查错别字校对软件 | 推荐
  10. 图片着色后存储为“JPEG”格式存在明显色差问题解决