首页 > 解决方案 > 如何在 CSS 中对齐表格

问题描述

我需要将表格向右对齐。我用过float:right,但还是不行。还有其他选择吗?

<table style="text-align:right; width:100%; float:right;">
  <td class="route-summary">
    <tr>
      <th>Drop No.</th>
      <th>Route Name/Destination</th>
    </tr>
  </td>
</table>

如您所见,两者text-align:rightfloat:right不起作用。

标签: htmlcss

解决方案


感谢您的信息.. 非常感谢。我正在解决问题。我只是添加了margin-left,它被移动了。:)

这就是代码。

<td>
<div style="text-align:right; margin-left:160px; width:100%;">                  
<table class="route-summary">
<tr>                             
<th>Drop No.</th>
<th>Route Name/Destination</th>
</tr>

推荐阅读