Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-values] cap-height unit? #660

Closed
tbredin opened this issue Oct 28, 2016 · 9 comments
Closed

[css-values] cap-height unit? #660

tbredin opened this issue Oct 28, 2016 · 9 comments
Labels

Comments

@tbredin
Copy link

tbredin commented Oct 28, 2016

I've just found out about the ch and ex units described here:
https://www.w3.org/TR/css3-values/#relative-lengths

Cap height: This is something that could become extremely useful in vertical rhythm projects such as Sassline and MegaType, which go to great length to attempt to find this height through other means (plus a lot of manual config adjustment). When combined with ex (and a speculative baseline position), we also start to build up a very useful picture of a font's vertical metrics.

The best measure of this is usually the height of a capital H in any font, but could likely also fall back to I or X.

Is this something that might be considered in future?

Further reading on some existing issues with typographic metrics on the web

@simevidas
Copy link
Contributor

Google has proposed (and is implementing) the CSS Step Sizing module, which enables “vertical rhythm using CSS”. What do you think? 😊

@SelenIT
Copy link
Collaborator

SelenIT commented Nov 5, 2016

There is also the CSS Line Grid module that also provides a CSS mechanism for vertical rhythm (including baseline snapping to regular grid lines).

But I believe that having better access to the font metrics from CSS would have more use cases other than that. For example, it can be aligning the icon with text (both top and bottom) or removing extra vertical spacing before text (e.g. in the approach described in this article) without having to use magic numbers for each particular font.

@fantasai
Copy link
Collaborator

fantasai commented Jan 12, 2017

RESOLVED: add cap unit to Values and Units Level 4 per WG resolution

@tabatkins
Copy link
Member

Added.

@karlhorky
Copy link

Thanks for this proposal for a cap unit for allowing font-sizing via the capital heights, really cool!

Does anyone know of any browsers that have considered or started implementation of this? I've been looking for tracking bugs, but haven't been successful...

@Crissov
Copy link
Contributor

Crissov commented Apr 3, 2021

Apparently none yet. https://caniuse.com/mdn-css_types_length_cap

@SebastianZ
Copy link
Contributor

I've now created a feature request to implement it in Gecko (Firefox).

Sebastian

@karlhorky
Copy link

Great, thanks @SebastianZ! Tweeted about it: https://twitter.com/karlhorky/status/1378683467098165248

@kizu
Copy link
Member

kizu commented Sep 10, 2022

Just wanted to note that this is currently implemented in Firefox!

There was also a ticket in Chromium for some time — https://bugs.chromium.org/p/chromium/issues/detail?id=1201220
And I did not find an existing ticket for Webkit, so I did open it — https://bugs.webkit.org/show_bug.cgi?id=245033

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants