【问题标题】:CSS - how to use modular scale for font sizeCSS - 如何使用模块化缩放字体大小
【发布时间】:2016-03-14 17:17:55
【问题描述】:

我有一个具有多种比率(1.5 和 1.25)的模块化量表:

http://www.modularscale.com/?16&px&1.5,1.25&web&text

我不知道我应该在我的 css 中填写什么来设置 font-size 遵循上述类型比例。我认为应该是:

p{ font-size: 1em; }
h4{ font-size: 1.25em; }
h3{ font-size: 1.5em; }
h2{ font-size: 1.563em; }
h1{ font-size: 1.953em; }

对吗?以及如何确定 line-height 值?

谢谢。

【问题讨论】:

  • 或者,您可以保持原样。
  • 您可以使用 CSS Vars + calc 来计算值而不是硬编码的浮动值。 (是的,我应该添加一个示例)

标签: css frontend font-size typography


【解决方案1】:
p{ font-size: 1em; }
h4{ font-size: 1.25em; }
h3{ font-size: 1.5em; }
h2{ font-size: 1.563em; }
h1{ font-size: 1.953em; }

这是确定的正确方法,你应该在css正文中提到行高

【讨论】:

  • 很抱歉投了反对票。在我看来,这个答案并不能很好地解释它。与有问题的示例也没有区别。
猜你喜欢
  • 1970-01-01
  • 2018-12-22
  • 1970-01-01
  • 2023-03-22
  • 2020-04-25
  • 2019-05-28
  • 2016-04-03
  • 2017-09-19
  • 2023-04-01
相关资源
最近更新 更多