开发者

Correct way to build forms [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 5 years ago.

Improve this question

I'm currently building a signup form and I find myself resorting to tables in order to align things properly e.g. the MySpace equivalent where I would use a colspan to achieve the even spacing between the开发者_JS百科 three birthday text areas and the other text inputs. Is this going against conventions and should I be looking into more advanced CSS?


I think you should drop the table all together and use more CSS. You could look into this: http://www.webcredible.co.uk/user-friendly-resources/css/css-forms.shtml


I prefer using Divs, floats and margins and not tables


It is generally against conventions. You should be using CSS to position your elements here. The CSS needn't be advanced though. E.g.

<div class="field-name"><label for="birthday">Birthday</label></div>
<div class="field"><input class="text-field" name="birthday" type="text" /></div>

CSS can be added to these elements.

.field-name{ float:left; width:100px; }
.field{float:left; width:150px;}

This should then position your fields next to each other. I'm not sure of your layout, but this is a simple example really. You can remove the divs as well if needed and change the CSS accordingly. I hope this helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜