html - CSS 中带斜线的字体大小

标签 html css size

这里的斜线是什么意思:

font: 100%/120%;

最佳答案

这实际上设置了两个属性,相当于:

font-size: 100%;
line-height: 120%;

引用official documentation :

The syntax of this property is based on a traditional typographical shorthand notation to set multiple properties related to fonts.

正如 David M 在评论中所说,它反射(reflect)了将字体大小指定为“x>pt on y>pt”的排版传统,以表示行高上的字形大小.

但是您问题中的示例实际上是错误的,浏览器会忽略它:您只能在 font 简写符号中组合这两个属性,并且您必须至少指定字体大小和系列。因此,简单地写 font: 100%/120%; 是不够的;您可以添加通用姓氏以使其有效,例如:

font: 100%/120% serif;

关于html - CSS 中带斜线的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/701732/

相关文章:

javascript - CSS 按视口(viewport)反转图像高度

jquery css 图片溢出隐藏左转

c++ - 如何查找数组中存在的元素数?

html - 如何在页脚和内容之间保持边距?

html - 网页页脚保留在浏览器窗口的底部

javascript - 如何在用鼠标单击时仅在 html 中找到完全相同且具有相同名称的两个类的类?

xml-parsing - pugixml 子节点数

html - 在 CSS 中使图像响应

php - HTML 选择然后填充输入框

html - position absolute 从元素中删除垂直滚动