There is a div with grid layout and fixed width.
One of its children is a container and has auto width through template.
Inside the container, here is the content I would like to make ellipsis.
It seems the container's width is incorrect, it does not equal to 300px - 30px - 50px
. How can I change this?
div {
box-sizing: border-box;
}
.grid-layout {
width: 300px;
display: grid;
grid-template-columns: 30px auto 50px;
}
.left {
grid-column-start: 1;
}
.ellipsis-container {
grid-column-start: 2;
}
.ellipsis-content {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.right {
grid-column-start: 3;
}
<div class="grid-layout">
<div class="left">Left</div>
<div class="ellipsis-container">
<div class="ellipsis-content">Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long Long</div>
</div>
<div class="right">Right</div>
</div>