问题是,我需要强制所有 div 排成一行。具有表格单元格行为。 并且支持IE7。
链接到小提琴http://jsfiddle.net/Beck/BH5WG/ 和下面的代码副本:
html:
<div class="wr">
<div class="con">
<div class="item">some text1</div>
<div class="item">some text1 some text1</div>
<div class="item">some text1</div>
<div class="item">some text1 some text1</div>
</div>
</div>
<div class="wr" id="wr2">
<div class="con">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<div class="item">some text1</div>
</td>
<td>
<div class="item">some text1 some text1</div>
</td>
<td>
<div class="item">some text1</div>
</td>
<td>
<div class="item">some text1 some text1</div>
</td>
</tr>
</table>
</div>
</div>
CSS:
.wr {
width:300px;
border:1px solid red;
}
.con {
height:24px;
}
.item {
float:left;
white-space:nowrap;
}
#wr2 {
margin:50px 0px 0px 0px;
}