Div Background Images & Contain/Cover

Hi, I'm having some problems with the whitespace appearing on these Card elements I'm using. When the browser window is tall or wide, there is white space showing on either side. I attempted using 'cover' in the third image here, but it's cropping off the important information. Trying to find a way to make the cards responsive while keeping the aspect ratio and also not showing the white space. I added a blue 2px dotted outline around the 4 section grid. The red 2px dotted outline shows the Box that contains the three cards with the image. The yellow 2px dotted outline shows the three cards within that. The final image attached is the design file from Figma.
No description
No description
No description
No description
No description
3 Replies
Lamer of Sweden
Hello! Is it possible for you to use https://codepen.io/pen/ or similar to display the code that you use, and recreate the problem that is. A lot easier to debug.
clevermissfox
clevermissfox5w ago
Use aspect-ratio
TRUEfoe
TRUEfoe5w ago
https://deploy-preview-510--qci-preview.netlify.app/technology/thin-film-lithium-niobate-foundry Nice! I think that did the trick @clevermissfox I always forget about that one.
Want results from more Discord servers?
Add your server