这个大小在 css {font: 14px/24px Arial, Helvetica, sans-serif} 中是什么意思

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5083192/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 23:46:46  来源:igfitidea点击:

What does this size mean in css {font: 14px/24px Arial, Helvetica, sans-serif}

cssfont-size

提问by Andrey

What is 14px/24px here? Which is the real font size?

这里的 14px/24px 是什么?哪个是真正的字体大小?

回答by thirtydot

It's the shorthand for the different font related properties. It means:

它是不同字体相关属性的简写。它的意思是:

font-size: 14px;
line-height: 24px;

font-family: Arial, Helvetica, sans-serif

See: http://www.impressivewebs.com/css-font-shorthand-property-cheat-sheet/

请参阅:http: //www.impressivewebs.com/css-font-shorthand-property-cheat-sheet/

enter image description here

在此处输入图片说明

回答by Gabriele Petrioli

First is font-sizethe second is line-height

第一个是font-size第二个是line-height

Quote from the specification for font shorthand

引用字体速记规范

'font'
Value: [ [ <'font-style'> || <'font-variant'> || <'font-weight'> ]? <'font-size'> [ / <'line-height'> ]?<'font-family'> ] | caption | icon | menu | message-box | small-caption | status-bar | inherit

'字体'
值:[[<'font-style'> || <'字体变体'> || <'字体重量'> ]? <'字体大小'> [ / <'行高'> ]?<'字体系列'> ] | 标题 | 图标| 菜单 | 消息框| 小字幕 | 状态栏 | 继承

回答by Chris Sobolewski

This is equivalent to

这相当于

#html{
    font-size:14px;
    line-height:24px;
    font-family: Arial, Helvetica, sans-serif;
}