html 表单开发的最佳实践是什么?
我一直在为每个 html 表单字段元素行使用 P 标签,但在 twitter 和 facebook 中,他们使用表格来设计表单,而 linkedin 对每个 html 字段行使用 ol 标签。 Ebay 使用 div 标签。
请建议开发 html 表单的最佳实践。
I have been using the P tag for each html form filed element row but in twitter and facebook they use table for designing a form and linkedin uses ol tags for each html field rows. Ebay uses div tags.
Please suggest a best practices to develop an html form.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
无论您使用哪种技术,请确保您 100% 符合 此 之类的工具。
Whatever technique you use, make sure you are 100% compliant with a tool like this.
对于这个问题,没有最佳实践。只需使用对您当前的页面布局更方便的任何方式即可。
There is no best practice on this issue. Just use whatever feels more convenient for your current page layout.
一个好的无表结果有点难以获得(您需要非常了解定位是如何工作的,并且存在与不同浏览器实现相关的几个问题),但是代码结果更容易理解并且更易于维护。此外,DOM 操作速度更快(关于它有很多话要说......:))。
表格布局更容易获得,并且是想象列、行和其中内容的更“自然”的方式。
顺便说一句,对于像表单这样的简单结构,使用哪种技术并不重要!
A good table-less result is a little hard to obtain (you need to know very well how positioning works, and there are several issues concerning different browsers implementations), but the code results more comprehensible and more maintainable. Moreover DOM manipulation is faster (there are tons of things to say about it... :) ).
Table layout is easier to obtain and it's a more "natural" way to imagine columns, rows and stuff inside them.
By the way, concerning a simple structure like a form, it really doesn't matter what kind of technique you use!
关于这个主题是否使用表格存在巨大的争论/意见分歧?坦率地说,双方的论点都很有说服力,但决定权完全取决于设计师/开发商。
如果您使用表格,那么您就会知道,就定位而言,您可以轻松控制 for 元素,并且如果您希望表格看起来很棒,确实可以将 CSS 应用于表格。
如果您使用 CSS,感觉您更有可能拥有更好的经过验证的代码并且“面向未来”,并且样式可以从 P 标签的集中样式(例如字体等)中选取。
就我个人而言,我根据几个因素做出决定...
3 我在乎吗?桌子已经存在很多年了,为什么不使用它们呢!?
请参阅这篇文章,它可能会有所帮助 Iron Spider - Tables vs CSS
抱歉,没有更具体,祝你好运!
There is a huge debate / gap in opinion on this subject, whether to use tables or not? And to be frank the arguments on both sides here are compelling however the decision firmly rests with the designer / developer.
If you use Tables then you know that as far as positioning is concerned you can control your for elements easily and indeed apply CSS to the tables if you want them to look awesome.
If you use CSS the feeling is your more likely to have better validated code and be 'Future Proof' and again styling can be picked up from centralised styles such as fonts etc for your P tags.
Personally I make the decision based on a few elements...
3 Do I care? Tables have been around for years so why not use them!?
See this article it may help Iron Spider - Tables vs CSS
Sorry not to be more specific and good luck!