如何指定系统的默认衬线和sans-serif字体系列? [英] How to specify the system’s default serif and sans-serif font-family?

查看:58
本文介绍了如何指定系统的默认衬线和sans-serif字体系列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

十多年前,当我学习CSS时,使用默认字体"(无论这意味着什么)的标准方法(也是唯一方法)是:

When I learned CSS over a decade ago, the standard (and only) way to use the "default fonts" (whatever that means) was:

font-family: serif;
font-family: sans-serif;

然后,去年,苹果公司添加了为其新的系统字体定制语法,如果我没记错的话,眨眼也做了类似的事情.

Then, last year, Apple added a custom syntax for their new system font, and Blink did something similar if I remember correctly.

如果CSS只想使用默认的sans-serif或serif字体,可以使用CSS的人来总结我的 font-family 属性如何吗?(我特别不想使用网络字体.)

Can someone who's more up-to-date with CSS summarize how my font-family property should look like when I just want the default sans-serif or serif font? (I specifically don't want webfonts.)

推荐答案

CSS字体模块4级草案引入了

The CSS Fonts Module Level 4 draft introduces new generic font families

对于大多数语言和脚本,可以将现有的泛型映射到与该脚本可比的东西.这对网络很有用,因此像 serif sans-serif 这样的泛型映射到合理的东西与内容的语言无关.但是印刷传统在世界范围内变化很大,许多脚本具有各种共同点字体设计无法清晰地映射到这些现有的通用名称中.在各种各样的情况下使用相似的字体的情况平台,扩展一组预定义的CSS通用类很有用字体系列以涵盖这些字体样式.

For most languages and scripts, existing generics can be mapped to something comparable to that script. That’s useful for the web so that generics like serif and sans-serif map to something reasonable independent of the language of the content. But typographic traditions vary widely across the world and many scripts have a variety of common typeface designs that don’t map cleanly into these existing generics. In situations where a similar typeface is used across a wide variety of platforms, it’s useful to extend the set of predefined CSS generic font families to cover these type styles.

如果要获取在目标平台上感觉最不适当的字体",则应为 system-ui :

If you want to get "the font that feels the least out-of-place on the target platfom", that would be system-ui:

system-ui 字体系列,代表给定平台

system-ui font family representing the default UI font on a given platform

这篇关于如何指定系统的默认衬线和sans-serif字体系列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆