So I've just discovered viewport units, and I really want to use them.
First challenge: My element has a "base size" of 760x670 pixels. I want to use viewport units to scale it up so that either the height is 100vh
, or the width is 100vw
, whichever is smaller.
Unfortnately, although I can use 100vmin
to get the smaller of the two, I can only apply it to the width or the height, not both.
Currently I'm using:
#root {
width: 760px;
height: 670px;
width: 100vw;
height: calc(670vw/760);
}
This scales the width to fit the screen, resulting in vertical scrolling. This isn't too bad, but I'd prefer it if I could actually have it fit the viewport.