More efficient (and direct) than the other solution here -- just set min-width
to 0.
.wrapper {
min-width:0;
}
(This is better than overflow:hidden
, because setting overflow
makes the browser create a scrollable area under the hood, which has a memory cost.)
See my answer on this other question for more on why this is needed in Firefox 34. (It's from a flexbox spec change, which so far has only shipped in Firefox.)
.container {
position: absolute;
width: 150px;
}
.innercontainer {
position: relative;
padding-right: 25px;
margin-bottom: 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.outerwrapper {
display: block;
height: 24px;
text-align: center;
font-size: 10px;
line-height: 24px;
margin-bottom: 5px;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
box-orient: horizontal;
-webkit-box-orient: horizontal;
flex-direction: normal;
-ms-flex-direction: normal;
-moz-flex-direction: normal;
-webkit-flex-direction: normal;
}
.wrapper {
flex: 1;
-ms-flex: 1 0 auto;
-moz-flex: 1;
-webkit-flex: 1;
-webkit-box-flex: 1;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
box-orient: horizontal;
-webkit-box-orient: horizontal;
flex-direction: normal;
-ms-flex-direction: normal;
-moz-flex-direction: normal;
-webkit-flex-direction: normal;
background-color: grey;
min-width:0;
}
.wrapper span {
display: block;
flex: 1;
-ms-flex: 1;
-moz-flex: 1;
-webkit-flex: 1;
-webkit-box-flex: 1;
text-align: left;
font-size: 10px;
padding: 0 5px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
color: #FFFFFF;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
<div class="container">
<div class="innercontainer">
<section class="outerwrapper">
<div class="wrapper">
<span>
super long string in here super long string
in here super long string in here
</span>
</div>
</section>
</div>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…