在列中显示多个复选框

时间:2012-03-09 22:42:14

标签: html markup checkbox

我想知道以下最佳方法是: (因为我是新手,所以无法发布图片,所以这里是截屏的链接) 多个Html复选框http://www.screencast.com/t/zcGnM3fkA

我需要将其包含在注册表单中,我想知道编写此代码的最佳方法是什么。我知道我可以使用html表,但我不确定这是否是最佳方法,因为我还有其他问题,如图中的#3,不需要多列。

如果我选择了html table选项,以下标记是否最合适?

 <table width="70%" cellspacing="3" cellpadding="3">
      <tr><td>1.) QUESTION GOES HERE?</td></tr>
    <tr>
      <td>
        <label>Watches</label><br />
          <input type="checkbox" class="all" /> Something </br>
          <input type="checkbox" class="all" />Something </br>
          <input type="checkbox" class="all" />Something </br>
          <input type="checkbox" class="all" />Something </br>
          <input type="checkbox" class="all" />Something </br>
      </td>
      <td>
        <label>Jewerly</label><br />
  <input type="checkbox" name="utType1[]" value="e" />Something </br>
  <input type="checkbox" name="utType1[]" value="e" />Something </br>
  <input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br>
      </td>
      <td>
        <label>Jewerly</label><br />
  <input type="checkbox" name="utType1[]" value="e" />Something </br>
  <input type="checkbox" name="utType1[]" value="e" />Something </br>
  <input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br>
      </td>
      </tr>
 <tr>
     <td>2.) QUESTION GOES HERE?</td>
      </tr>
  </table>

这里的小提琴演示:http://jsfiddle.net/yAHyr/

或者这个标记会更合适吗?

<table>
<tbody>
 <!-- What should I use here to add a question with the instructions? -->
<tr>
<th>watches</th>
<th>jewerly</th>
<th>jewerly</th>
</tr>
<tr>
<td>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br> 
</td>
<td>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br> 
</td>
<td>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br> 
</td>
</tr>
<!-- What should I use here to add a question with the instructions? -->
<tr>
<th>watches</th>
<th>jewerly</th>
<th>jewerly</th>
</tr>
<tr>
<td>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br> 
</td>
<td>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br> 
</td>
<td>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>
<input type="checkbox" name="utType1[]" value="e" />Something </br>    
<input type="checkbox" name="utType1[]" value="e" />Something </br> 
</td>
</tr>
</tbody>
</table>

最后,如何在说明中添加问题?如果我把它放在td中,它会向右推动其他tds中的内容。

0 个答案:

没有答案