开发者

How to get align a form like table using div?

Here is my code:

<div>
    <label>Name</label><input type="text" id='name'/><br />
    <label>Email</label><input type="text" id='email'/><br />
    <label>Place</label><input type="text" id='place'/><br />
</div>

I'm new to CSS, I don't want table to get aligned, but the perfection should开发者_高级运维 be like same, and don't want to apply style to individual elements. Any help is appreciated.


I'm assuming you want to align the labels and inputs next to one another, in which case you'll be needing floats. Here's the quick css code:

form {
 width: 500px;
 overflow:hidden;}

label {
 clear: both;
 float: left;
 width: 40%;}

input {
 float: left;
 width: 55%;}

I think that should work :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜