开发者

Creating a form with floats, what is the general design when you need 2 columns, p and label?

开发者 https://www.devze.com 2022-12-24 12:00 出处:网络
I want to design a form. The form has 3 sections: user info, shipping and billing. Each section will have 2 columns, so form fields and their labels with be on both the left and right side.

I want to design a form.

The form has 3 sections: user info, shipping and billing.

Each section will have 2 columns, so form fields and their labels with be on both the left and right side.

What technique should I use?

How does this look?

<div id="forms">
 <div id=contact>
      <div class=left>
               <p&g开发者_如何学Ct;<label>Firstname<label><input type=text /></p>
      </div>
      <div class=right></div>
 </div>
 <div id=shipping></div>
<div id=billing></div>
</div>

Any tricks with the css i should know about?


I would use fieldsets with legends for the individual blocks. you can float the labels left without the extra divage e.g.

<form>
<fieldset>
<legend>block 1</legend>
<p>
<label>blah1</label><input type="text" name="blah1" value="" />
</p>
<p>
<label>blah2</label><input type="text" name="blah2" value="" />
</p>
</fieldset>
<fieldset>
<legend>block 2</legend>
<p>
<label>blah3</label><input type="text" name="blah3" value="" />
</p>
<p>
<label>blah4</label><input type="text" name="blah4" value="" />
</p>
</fieldset>
<p><button type="submit">submit</button></p>
</form>
0

精彩评论

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