DIV上述< TD>右浮动 [英] DIV in <td> float right

查看:620
本文介绍了DIV上述< TD>右浮动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,一对夫妇< TD>

I got a table with a couple <td>:

<table>
 <tr>
  <td>First</td>
  <td>Second</td>
  <td style="padding:20px;">
      <div>
        Third
      </div>
  </td>
 </tr>
</table>

我想要做的是把第三&LT; TD&GT; (用DIV)表的右侧,第一 二&LT; TD方式&gt; 应靠左

What I want to do is to place the "Third" <td> (with the div) to the right side of the table and the "First" and "Second" <td> should stay left.

浮动风格:权利; 我没有工作......

Style with float:right; didn't work for me...

推荐答案

您需要让你的表格的宽度为100%,那么控制你的第2列的宽度,最后右对齐的第三列。

You need to make your table's width 100%, then control the widths of your first 2 columns, and finally right-align your third column.

http://jsfiddle.net/25Mqa/1/

<table>
 <tr>
  <td class="first">First</td>
  <td class="second">Second</td>
  <td class="third">Third</td>
 </tr>
</table>

CSS:

table { width:100%; }
.first, .second { width:50px; }
.third { text-align:right; }

这篇关于DIV上述&lt; TD&GT;右浮动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆