[Idea] New CSS Units

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.

3 Likes

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

1 Like

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

1 Like