Kevin Powell - CommunityKP-C
Kevin Powell - Community3y ago
10 replies
ŽoHo

CSS grid and image

So im having issues with image behaviour in css grid. HTML and CSS code will be provided down but to explain:
I have 2 columns in grid where one (containing img) is 35% width while other (content) is 1fr or 65% meaning rest of the grid width. Now when i resize dimensions to make it smaller using inseptor tool (responsive) it works as it should. The image witdh is 35% and its height is equal to height of content div. But when i expand the dimensions the image continues to expand and because of that makes the content div height bigger and bigger making white space in it.

What I want is that height of image stops expanding and is equal to height of container div. Without setting fixed height since content div should be able to get or lose more elements so its height will be changed depending on the content that is rendered.
Was this page helpful?