开发者

Web forms: better tables or lists

what it better practices for creating web forms, using table开发者_JS百科s or lists ?

Regards

Javi


Neither.

A form is just a form. It might consist of paragraphs, simple blocks (divs), or something else.

Sometimes that forms are tabular or lists, but not often.


There is no such a rule :-) You should use tables for tabular content, you shouldn't use it for you page layout since it's a bad html practice.

You'll find a lot about it on google. Tables vs DIV


It depends on your context. If we're speaking about web forms with labels and input fields, then having a structure using divs is most comfortable for a concept of composition

<div>
   <label... for="..">
   <input type="text"...>
</div>

<subcontrol...>

<div>
   <label... for="..">
   <input type="text"...>
</div>

This is then properly formatted by using CSS s.t. the things are well aligned in the form

Label:         input field
Label2:        input field

Composition therefore because as you see in the "HTML" above "subcontrol" may be an arbitrary reference to a control containing again the same div structure and the finally produced page would just look nicely.

The same may apply to tables, but the concept of composition already gets messier since you get nested tables as the result. Moreover some screenreaders often have problems with those nested tables (as many argue, have never tried it though).

Conclusion: It really depends on how you're accustomed to it. Personally I prefer divs and CSS because you can control it better once you have defined your overall layout.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜