I have a flex layout which looks like this:
That's fine but when the product description is very long, I want to hide the overflow and show an ellipsis.
There is a flex container with the class info-container
which has 2 flex children - left
(30%) and right
(70%). The right
div is itself a flex container. The problem is this div
expands when the text is too long:
The HTML is:
<div class="info-container top">
<div class="left">
<div class="item-image-container">
<div class="item-image" >
<img height="75" width="75" src="https://static.pexels.com/photos/60597/dahlia-red-blossom-bloom-60597.jpeg" />
</div>
</div>
</div>
<div class="right">
<h2>
header
</h2>
<div class="product-description">
product desc stuff product desc stuff stuff product desc stuff stuff
</div>
</div>
</div>
And the CSS is:
.info-container {
margin-left: 300px;
display: flex;
flex: 0 0 100%;
flex-direction: row;
justify-content: center;
padding-bottom: 20px;
width: 400px;
border: 1px red solid;
padding: 3px;
}
.left {
font-size: 2.5rem;
flex-direction: row;
justify-content: center;
align-items: center;
flex: 30%;
}
.right {
flex: 70%;
}
h2 {
font-weight: bold;
min-width:0;
}
.product-description {
min-width:0;
font-sixe: 16px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
h2 {
margin: 0;
}
The jsfiddle is here.
How can I ensure the right div
does not expand if the text is too long, and instead an ellipsis is shown?