我有两个div,我想内联(一个在左边,一个在右边)。右边那个包含一行文字。我希望它始终是一行文本,并在必要时省略。我不能正确地进行内联,因为当我的文本太长时,正确的div跳转到左侧。例如:内嵌块无法按预期方式使用长内容?
<!doctype>
<html>
<head>
<style type="text/css">
#panelLeft {
display: inline-block;
width: 50px;
height: 20px;
background-color: #f00;
}
#panelRight {
display: inline-block;
background-color: #0f0;
/* width: 200px; */ works ok if explicitly sized
}
#test {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div id="panelLeft">
</div>
<div id="panelRight">
<div id="test">
This is some text that's longer than usual and that I'd like to have ellipsized, and forced to a single line, always.
</div>
</div>
</body>
</html>
如果代替我指定panelRight的宽度(其等于或小于剩余空间短),然后我的div是在同一直线上,并且ellipsizing正确显示。如果我不知道panelRight的确切宽度,我怎么才能得到这个工作?
感谢