如何根据上一个按钮对齐表格中的按钮

时间:2016-12-14 06:45:22

标签: html css jsp stylesheet

如何移动按钮以与右侧的按钮对齐,如下所示:

enter image description here

html如下:

<table>
  <tr>
    <td>
      <h4> Search: </h4>
    </td>
    <td>
      <input type="text" />
    </td>
    <td>
      <button type="submit" name="abc" form="submitForm" value="Button">Button</button>
    </td>
  </tr>
  <tr>
    <td class="customView">
      <button type="submit" name="def" form="submitForm" value="Button">Button</button>
    </td>
  </tr>
</table>

2 个答案:

答案 0 :(得分:1)

colspan="3"align="right"添加到您的<td>代码中,工作正常,我已添加以下代码段。

&#13;
&#13;
<table>
          <tr>
            <td><h4> Search: </h4></td>
            <td><input type="text"/> </td>
            <td><button type="submit" name="abc" form="submitForm" value="Button">Button</button></td>
          </tr>
          <tr  >
             <td class="customView" colspan="3" align="right"><button type="submit" name="def" form="submitForm" value="Button">Button</button></td>
          </tr>
     </table>
&#13;
&#13;
&#13;

答案 1 :(得分:1)

<table>
  <tr>
    <td>
      <h4> Search: </h4>
    </td>
    <td>
      <input type="text" />
    </td>
    <td>
      <button type="submit" name="abc" form="submitForm" value="Button">Button</button>
    </td>
  </tr>
  <tr>
  <td colspan="2"></td>
    <td class="customView">
      <button type="submit" name="def" form="submitForm" value="Button">Button</button>
    </td>
  </tr>
</table>