I have a layout with an image on the left and some text content on the right. It is laid out something like this:
.left {
max-width: calc(100% - 150px);
float: left;
}
img {
width: 300px;
max-width: 100%;
}
<div class="wrapper">
<div class="left"><img src="https://i.sstatic.net/W6Sd8.png" /></div>
<div class="right">Hello, I am Kitteh</div>
</div>
The basic idea is that the image can be up to 300px but must always leave at least 150px for the text content to the right. The text content will fill up as much space as possible - which will always be at least 150px left by the image.
My goal is to recreate this using CSS grid, but I am confused by how to use grid-template-columns to get the same behaviour. At the moment I have something like this:
.wrapper {
display: grid;
grid-template-columns: auto minmax(150px, auto);
}
img {
width: 300px;
max-width: 100%;
}
<div class="wrapper">
<div class="left"><img src="https://i.sstatic.net/W6Sd8.png" /></div>
<div class="right">Hello, I am Kitteh</div>
</div>
This respects the 150px minimum for the right hand column, but doesn't expand to meet the image. How can I get the grid layout to behave the same as the floats in my first example?