This question already has an answer here:
- How can I get FF 33.x Flexbox behavior in FF 34.x? 2 answers
I have a container which is 300px wide with two flexed divs inside.
The second one is 100px wide and the other should take up the remaining space.
When I place text wider than the remaining 200px in the first div, it overflows and I can use overflow: hidden
and text-overflow: ellipsis
to add the ...
when the text overflows.
When I put a h1
tag within the first div and add the overflow
and text-overflow
should create the same effect.
And it does (in Chrome), but in IE and Firefox the div grows larger and the ellipsis doesn't work.
When I remove the additional h1
layer and update the css accordingly, the described behavior works as expected.
Or look at my JSFiddle
body{
display: flex;
}
#container{
display: flex;
flex-basis: 300px;
overflow: hidden;
}
#content{
display: block;
height: 300px;
background-color: red;
flex-grow: 1;
flex-shrink: 1;
}
h1, h2{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
#menu{
display: flex;
flex-grow: 0;
height: 300px;
background-color: blue;
flex-shrink: 0;
}
<div id="container">
<div id="content">
<h1>HEADER1 HEADER1 HEADER1 HEADER1 HEADER1 HEADER1 HEADER1<h1>
</div>
<div id="menu">xcvcxcxvcvxcvzxczxczgd</div>
</div>