Skip to content

Files

Latest commit

 

History

History
18 lines (16 loc) · 736 Bytes

129.md

File metadata and controls

18 lines (16 loc) · 736 Bytes
title date submitter number tags discussion
I want CSS to have access to font metrics
2020-02-27 23:15:20 UTC
Christopher Kirk-Nielsen
129
css

There are a lot of typography-related properties in CSS, but we are still far from what can be done in print. For instance, we rely on hacks to clean up the start/end of a paragraph's ascender/descender space for optical alignment. It would be useful to expose some font metrics to CSS to be able to adjust this in a clean way:

h1 {
  margin-top: calc(font(--x-height) - font(--ascender-height) );
}

Imagine the possibilities with a font function similar to custom properties or environment variables!