November 15, 2017 04:22 pm GMT
Original Link: https://css-tricks.com/aspect-ratios-grid-items/
Aspect Ratios for Grid Items
We've covered Aspect Ratio Boxes before. It involves trickery with padding such that an element's width and height are in proportion to your liking. It's not an ultra-common need, since fixing an element's height is asking for trouble, but it comes up.
One way to lower the risk is The Psuedo Element Tactic, in which a pseudo element pushes its parent element to the aspect ratio, but if the content inside pushes it taller, it will get taller, aspect …
Aspect Ratios for Grid Items is a post from CSS-Tricks
Original Link: https://css-tricks.com/aspect-ratios-grid-items/
Share this article:
Tweet
View Full Article