我想要实现的是所有元素都在同一行,但是text-overflow
如果中间的段落比可用空间更宽,则可以启动,但如果不是,那么正确的浮动应该仍然在同一行.
代码笔: http ://codepen.io/anon/pen/hHvCA
HTML:
<div id="outer">
<div id="left"></div>
<div id="middle">
<p>Can this paragraph fill the space between the left and right floats without making the right float wrap?</p>
</div>
<div id="right"></div>
</div>
CSS:
#outer {
background-color: #222;
height: 100px;
width: 100%;
}
#left {
background-color: #555;
width: 100px;
height: 100px;
float: left;
}
#right {
background-color: #777;
width: 200px;
height: 100px;
float: right;
}
#middle {
background-color: #999;
height: 100px;
}
#middle > p {
line-height: 100px;
color: #eee;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
font-family: monospace;
}