When I use align-items: end in my example, the content overflows and I have no idea why. I expect the same behavior as with align-items: start. I tried setting the width but I couldn't find a solution.
Here is live demo: https://stackblitz.com/edit/stackblitz-starters-zyhkev?file=index.html
Thanks for your help.
* {
box-sizing: border-box;
}
.grid {
display: grid;
grid-template-columns: 50% 50%;
gap: 5px;
}
.cell {
display: flex;
flex-direction: column;
border: 1px solid red;
}
.cell.end {
align-items: end;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
<div class="grid">
<div class="cell">
<div>Label</div>
<div class="ellipsis">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</div>
</div>
<div class="cell end">
<div>Label</div>
<div class="ellipsis">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</div>
</div>
<div class="cell end">
<div>Label</div>
<div class="ellipsis">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</div>
</div>
<div class="cell">
<div>Label</div>
<div class="ellipsis">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</div>
</div>
</div>
You need to give the ellipsis class a width. Otherwise it doesnt know where to break. Try:
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
}