我正在尝试在单行中有3个跨度。左边的跨度应该是固定的宽度。右边的跨度是向右浮动的,宽度也是固定的。中间的跨度是消耗两个跨度之间的空间。这3个跨度是从数据库中提取的,因此除了第三个跨度之外,每个字段中都有多个不同值的行,它将作为一个delete按钮。我已经尝试了所有方法让它们排成一排,到目前为止,我已经成功地制作了左边的display: inline-block和float: left,the right: float:right display:inline-block,但是中间不想扩展以填充两个跨度之间的空间,即使在将它更改为display:block之后也是如此。
如果能帮上忙,我们将不胜感激!
/*Left Span*/
.word_native{
float: left;
clear: left;
margin-top: 7px;
height:22px;
line-height:22px;
margin-left: 10px;
margin-right: 10px;
}
/*Middle Span*/
.word_foreign{
margin-top: 6px;
height:22px;
height:22px;
line-height:22px;
line-height:22px;
display:inline-block;
}
*/
/*Right Span*/
float: right;
clear: right;
margin-top: 6px;发布于 2012-12-05 20:56:18
看起来你所做的对于一个表格来说是完美的,那么为什么不使用一个html表格呢?
<table>
<tr>
<td class="word_native">native</td>
<td class="word_foreign">foreign</td>
<td class="del">del btn</td>
</tr>
<tr>
<td class="word_native">native</td>
<td class="word_foreign">foreign</td>
<td class="del">del btn</td>
</tr>
...
</table>然后,您可以通过CSS将第三列设置为固定宽度。
https://stackoverflow.com/questions/13723445
复制相似问题