【问题标题】:how to center a checkbox with text in a table cell?如何在表格单元格中将带有文本的复选框居中?
【发布时间】:2013-01-19 13:33:55
【问题描述】:

我在对齐表格单元格中的复选框时遇到问题

<table style="empty-cells:hide;" border="1"   cellpadding="1" cellspacing="1">

<tr>
    <td valign="top">
        test 1 - 
        <input type="checkbox" name="query_myTextEditBox">    
        test 2 - 
        myTextEditBox
        <select size ="3" name="myTextEditBox_compare_operator">
            <option value="1">option 1</option>
            <option value="2">option 2</option>
        </select>
    </td>

    <td valign="top">
        <input type="text" value="my text" name="myTextEditBox">
    </td>

</tr>

my test on jsfiddle.net

出于某种特定原因,我不想将文本和复选框分成 2 个单元格

我确实看到了这个帖子How to center a checkbox in a table cell?,但它对我不起作用。

【问题讨论】:

标签: html html-table


【解决方案1】:

style="vertical-align:top" 添加到&lt;select&gt; 元素。

【讨论】:

  • 它几乎可以工作。见这里jsfiddle.net/dsea/QCr3a/4。我想知道第一个是否可以像第二个一样对齐?谢谢
  • 我说要添加到&lt;select&gt;,而不是&lt;input&gt; ;)
猜你喜欢
  • 2011-06-30
  • 2013-07-23
  • 2015-02-25
  • 2011-11-30
  • 1970-01-01
  • 2011-09-03
  • 2012-06-16
  • 2021-12-29
  • 2017-06-17
相关资源
最近更新 更多