表单域和表格

表单域

用 fieldset 标签包起来,并用 legend 标签说明表单用途。

注:

Fieldset border:none;
Legend display:none;

Input 标签对应说明文本使用 label 标签,并且通过为 input 设置 id 属性,在 label 标签中设置 “for=someid” 来说明文本和相应的 input 关联起来。
例如:

<label for="name">帐号:</label>
<input id="name" type="text" /> // ie6 使用 javascript 调用 id 可能有错误可使用 name 属性。

表格

表格标题要用 caption,表头要用 thead 包围,主体部分用 tbody 包围,尾部要用 tfoot 包围,表头和一般单元格要区分开,表头用 th,一般单元格用 td
例如:

<table border="1">
    <caption>几种页面实现的比价</caption>
    <thead>
        <tr>
            <th>实现方式</th>
            <th>代码量</th>
            <th>搜素引擎友好</th>
            <th>特殊终端兼容</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <th>table布局</th>
            <td>多</td>
            <td>差</td>
            <td>一般</td>
        </tr>
    </tbody>
</table>

除非注明, 风波竹林 文章均为原创,转载请以链接形式标明本文地址
本文地址: https://blog.fbzl.org/表单域和表格/

发表评论