🔤 Typography Scale Generator
📐 工作原理与说明
字号 size(n) = base × rⁿ(r 为模数比,如 1.25 为大三度、1.618 为黄金比)
基于模数化排版比例:以基准字号按比例派生标题到正文的字号阶梯,输出字号表与 CSS,用于建立一致的排版层级。
Build a font-size ladder from a ratio such as 1.25 and export a heading-to-body scale table and CSS for a consistent hierarchy.
导出的 CSS 会写入所选字体;目标设备需安装该字体,否则使用字体栈中的回退字体。
📚 深度解析:字体比例尺
💡 常见使用场景
- 统一标题层级。
- 设计系统字号。
- 排版规范。
生成 1.25 比例
输入:基 16px、比 1.25、6 档。
处理:以正文为基准递推字号,并生成 body、h1–h5、展示级类规则。
输出:--body-size…、--display-size 等变量与可直接套用的 CSS;字体选择写入 --font-family。
❓ 常见问题(FAQ)
- 比例选多大?
- 1.2 紧凑、1.25 通用、1.333 舒展;按气质选。
- 基字号怎么定?
- 正文通常 16px 起;过小伤可读,按受众与设备调整。
- 会保存或上传我的内容吗?
- 结果以浏览器实时计算为准,纯前端本地处理、数据不上传;生成的样式与代码仅作快速产出参考,正式项目请以设计系统、规范与浏览器实测为准。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Modular ratio | each step multiplies the previous size by a fixed ratio | Modular scale convention |
| Line height coupling | smaller sizes need larger relative leading, often 1.4 to 1.6 | Bringhurst, The Elements of Typographic Style |
| Step legibility | steps below a 1.2 ratio are hard to tell apart | Modular scale convention |
⚠️ 使用说明与注意事项
- 本工具纯前端运行,数据不会上传到服务器
- 建议在主流浏览器(Chrome/Safari/Firefox/Edge)中使用
- 计算结果仅供参考,请以实际应用场景为准