A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

[Idea] New CSS Units

block_noir
2021-08-18

I have this idea for new relative CSS units; they are similar to the ‘vh’ and ‘vw’ units but instead of being relative to the dimensions of the viewport, they would be relative to the dimensions of the parent element. Therefore it could be easier to create ‘divs’ with specific aspect ratios, and probably make life much more convenient for CSS purists. I know that there is the ‘%’ unit but it doesn’t allow the use of a height percentage for a width and vice versa.

M-J-Robbins
2021-08-23

I believe these might already be covered in this draft. https://drafts.csswg.org/css-contain-3/#container-lengths

block_noir
2021-08-24

Well this is profoundly better than my idea! Looking forward to use these practical units.

yuvsaha123
2022-02-03

thanks for the awesome information.