尝试从黄金网格系统中调整可缩放基线网格:https ://github.com/jonikorpi/Golden-Grid-System/blob/master/GGS.css
这是相关的CSS(除非我遗漏了什么):
/*
*
* Zoomable baseline grid
* type size presets
*
*/
body {
/* 16px / 24px */
font-size: 1em;
line-height: 1.5em;
}
.small {
/* 13px / 18px */
font-size: 0.8125em;
line-height: 1.3846153846153846em;
}
.normal, h3 {
/* 16px / 24px */
font-size: 1em;
line-height: 1.5em;
/* 24 */
}
.large, h2, h1 {
/* 26 / 36px */
font-size: 1.625em;
line-height: 1.3846153846153846em;
}
.huge {
/* 42px / 48px */
font-size: 2.625em;
line-height: 1.1428571428571428em;
}
.massive {
/* 68px / 72px */
font-size: 4.25em;
line-height: 1.0588235294117647em;
}
.gigantic {
/* 110px / 120px */
font-size: 6.875em;
line-height: 1.0909090909090908em;
}
我想不通的是:为什么行高会随着字体大小变大而变小?
我正在尝试制作自己的基线网格,但我似乎无法推断导致这种模式的方程。
显然字体大小来自经典
目标÷上下文=结果
如果您对字体大小进行数学运算,则可以解决。例如对于 h2:
26px ÷ 16px = 1.625em
但该数学分解为线高。
奇怪的是为什么 .small 类的 line-height 与 .large、h1、h2 的 line-height 相同……但是,这是我最不关心的问题。