I want the grid cell to fit as much text as possible until the text would not wrap on a second line.
I'm using the text ellipsis technique but it does not work when used in a grid.
In the codepen link below i was able to nowrap the text but it causes the cell grid to expand. Any idea why?
Additional I would to avoid any space between each column, that's why i want to avoid fix sizes.
Codepen: https://codepen.io/gregorym/pen/oNvVzqB?&editable=true
<div id="container">
<div>
<span>Item as wide as the content, but at most 300 pixels. Item as wide as the content, but at most 300 pixels. Item as wide as the content, but at most 300 pixels. Item as wide as the content, but at most 300 pixels. Item as wide as the content, but at most 300 pixels. </span>
</div>
<div>
Item with flexible width but a minimum of 200 pixels.
</div>
<div>
Inflexible item of 150 pixels width.
</div>
</div>
#container {
display: grid;
grid-template-columns: minmax(min-content, auto) minmax(200px, 1fr) 150px;
grid-gap: 5px;
box-sizing: border-box;
height: 200px;
width: 100%;
background-color: #8cffa0;
padding: 10px;
}
#container > div {
background-color: #8ca0ff;
padding: 5px;
}
#container > div > span {
color: red;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}