制作网页表单的最佳做法 [英] Best practice for making web forms
问题描述
使用表格制作网页表单还是应该使用div的?我知道如何使用表格,但我应该如何使用div来创建表格?还是使用表格更好?
< form方法= POST >
< table>
< tr>
< td>
< label for =用户名>用户名:< / label>
< / td>
< td>
< input type =textname =usernameid =username/>
< / td>
< / tr>
< tr>
< td>
< label for =password>密码:< / label>
< / td>
< td>
< input type =passwordname =passwordid =password/>
< / td>
< / tr>
< tr>
< td>
< input type =submitname =cancelvalue =Cancel/>
< / td>
< td>
< input type =submitname =sendvalue =Send/>
< / td>
< / tr>
< / table>
< / form>
可能重复: Why-not-use-tables-for-layout-in-html
不要使用表格,这是脆弱,非语义布局,使用正确的CSS布局。以下是一些演示文稿,解释了一些良好的表单布局方法,包括可用性考虑因素。第一个链接更多的是关于代码,第二个链接更多的是关于设计和可用性的考虑: www.slideshare.net/AaronGustafson/learning-to-love-forms-web-directions-south-07rel =noreferrer>学习爱表单(Web Directions South '07)
Is it ok to use tables to make web forms or should I use div's? I know how to use tables, but how should I make form with div's or is it better to use tables?
<form method="post">
<table>
<tr>
<td>
<label for="username">Username:</label>
</td>
<td>
<input type="text" name="username" id="username"/>
</td>
</tr>
<tr>
<td>
<label for="password">Password:</label>
</td>
<td>
<input type="password" name="password" id="password"/>
</td>
</tr>
<tr>
<td>
<input type="submit" name="cancel" value="Cancel"/>
</td>
<td>
<input type="submit" name="send" value="Send"/>
</td>
</tr>
</table>
</form>
Possible Duplicate: Why-not-use-tables-for-layout-in-html
Don't use tables, that's a very brittle, non-semantic layout, use proper CSS layout. Below are some presentations that explain some good approaches to form layout, including usability considerations. The first link is more about the code, and the second more about design and usability considerations:
这篇关于制作网页表单的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!