CSS - Consistent image sizing with CSS object-fit

Опубликовано: 03 Ноябрь 2024
на канале: CodeBytes
144
3

A common problem you might encounter, especially when you're displaying many user uploaded images in a grid or masonry layout, is displaying them in a consistent size. Thankfully, CSS object-fit makes it fairly painless, without having to use Javascript or forcing the user to manually crop the image.

Codepen: https://codepen.io/codebytes_io/pen/E...
Browser support: https://caniuse.com/#feat=object-fit
Music: Lost Time by Eveningland

🔥 Bytesized Dev Tips
✋🏻 Tom
💻 Frontend Developer
🏠 Leeds, UK
✉️ [email protected]
🛠 HTML, CSS, Javascript, React, React Native, Redux, Gatsby, Wordpress