w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.47k stars 658 forks source link

[css-contain-3] Add container-font relative units #8855

Open mirisuzanne opened 1 year ago

mirisuzanne commented 1 year ago

In https://github.com/w3c/csswg-drafts/issues/7858, there was mention of cqem as a useful alternative to rem units - based on the container font size, rather than the root font size. This seems like it could be useful for line height as well:

Less essential, but also worth considering (I don't think these have root versions?):

andruud commented 1 year ago

I don't think these have root versions?

They do have root versions, but it's not widely supported in browsers yet. https://drafts.csswg.org/css-values-4/#font-relative-lengths

css-meeting-bot commented 1 year ago

The CSS Working Group just discussed [css-contain-3] Add container-font relative units, and agreed to the following:

The full IRC log of that discussion <dael_> miriam: We added cq units that are similar to viewport. cqi, cqv etc. several use cases for getting something like rems but relative to container. cqch, cqx [missed]. cqm and cqlh are clearest
<fantasai> sgtm
<dael_> miriam: Other question is this came from an issue we resolved by adding functions for cq units so you could access the unit on a specific container. We can consider that here.
<TabAtkins> q+
<dael_> miriam: Question is do we want these 4 cq relative units
<astearns> ack TabAtkins
<dael_> TabAtkins: I think this is reasonable. We also should put this into functional syntax. If you can access some aspects of an arbitrary container, getting to the font bits makes sense
<dael_> TabAtkins: +1 to the full proposal
<una> +1 this proposal makes sense!
<florian> s/cqx/cqex/
<florian> s/cqm/cqem/
<dael_> astearns: Prop: Add these four container font relative units and theri functional versions to target specific containers
<dael_> astearns: obj?
<dael_> RESOLVED: Add these four container font relative units and their functional versions to target specific containers
myakura commented 1 year ago

RESOLVED: Add these four container font relative units and their functional versions to target specific containers

There are cap and ic defined in the spec. Are there any reason for excluding them?

mirisuzanne commented 1 year ago

I don't think so, that may have just been an oversight on my part.

lilles commented 1 year ago

I would expect all font-relative units to be added, like for root units (the comment about possible missing root units in the original post is not correct):

https://drafts.csswg.org/css-values/#font-relative-lengths