CSS字体速记中的正斜杠是什么意思? [英] What does the forward slash mean in the CSS font shorthand?

查看:83
本文介绍了CSS字体速记中的正斜杠是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在样式表中看到以下CSS声明:

I'm seeing the following CSS declaration in a stylesheet:

font: 12px/18px ...

12px/18px部分的确切含义是什么?

What does the 12px/18px part mean exactly?

推荐答案

12px是字体大小,18px是行高.

12px is the font size, 18px is the line height.

该语法基于用于指定各个大小的印刷符号,并且仅适用于font速记属性.换句话说,上面的声明只是扩展为以下内容:

The syntax is based on typographical notation for specifying the respective sizes, and is only applicable to the font shorthand property. In other words, the above declaration simply expands to the following:

font-size: 12px;
line-height: 18px;

与往常一样,如果将行高设置为相对值(例如,百分比或ems),则会相对于字体大小进行计算.

As always, if you set the line height to a relative value (e.g. percentage or ems), it's calculated relative to the font size.

W3C CSS2.1 font属性参考
W3C CSS3字体模块font属性参考(语法沿用来自CSS2.1)

W3C CSS2.1 font property reference
W3C CSS3 Fonts Module font property reference (the syntax carries over from CSS2.1)

这篇关于CSS字体速记中的正斜杠是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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