2 ms·
Not really. It's still tied to the element's width and will overflow vertically. Even if using a flex/grid container with a different axis, it will only constra
by baxuz 5y ago
Not really. It's still tied to the element's width and will overflow vertically. Even if using a flex/grid container with a different axis, it will only constraint the aspect ratio to its width.
Which means that if you want to have something like a video player in the viewport like YouTube does, or lightbox-style previews which keep the entire media element in viewport you'll still have to use JS to limit the element's height, or if the design allows for it, use viewport height units + calc.