I have a grid layout like the one in header
below. There is a text in the div whose width is 1fr
. I want the text inside that div to be truncated when it is too long. Adding text-overflow
as ellpsis
is not working. Any idea how to do it?
It has to be grid and there is no way I can change that.
html,
body {
height: 100%;
width: 100%;
overflow: hidden;
}
body {
display: flex;
}
.container {
display: flex;
flex-direction: column;
flex: 1;
}
content {
flex: 1;
background-color: red;
}
header {
background-color: limegreen;
display: grid;
grid-template-columns: 0fr 1fr 0fr;
}
header div {
border: 1px solid orange;
}
.long {
text-overflow: ellipsis;
}
<div class="container">
<header>
<div>Left</div>
<div class="long">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</div>
<div>Right</div>
</header>
<content>
</content>
</div>