[英]How can I position elements within a table cell (td) such that one element is left aligned and the other right aligned?
Given the html code below: 鉴于下面的HTML代码:
<tr>
<td>Some text <a href="">Some link</a> <button>Some Button</button></td>
</tr>
I would like to achieve something like this: 我想实现这样的目标:
Would I need to add additional mark-up such as wrapping divs to float one to the left and the other to the right? 我是否需要添加额外的标记,例如将div包装为左侧浮动,另一侧浮动? I would also need elements within the td to be vertically aligned. 我还需要在td内的元素垂直对齐。
What would be the best way to achieve this with minimal additional mark-up. 以最小的额外加价实现这一目标的最佳方法是什么。
I have sample code here: http://jsfiddle.net/stormwild/AAw78/17/ 我在这里有示例代码: http : //jsfiddle.net/stormwild/AAw78/17/
A related problem is how to keep alignment of the text consistent among table cells when one cell contains a floated element? 一个相关的问题是当一个单元格包含浮动元素时如何保持表格单元格之间文本的一致性?
CSS: td button { float: right; }
CSS: td button { float: right; }
td button { float: right; }
sorted. 排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.