表单域之间的间距 [英] spacing between form fields

查看:91
本文介绍了表单域之间的间距的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML表单元素:

I have an HTML form element:

<form action="doit" id="doit" method="post">
Name <br/>
<input id="name" name="name" type="text" /> <br/>
Phone number <br/>
<input id="phone" name="phone" type="text" /> <br/>
Year <br/>
<input id="year" name="year" type="text" /> <br/>
</form>

我希望字段之间(例如,行之间)有更多的空间

I would like there to be a little more space between the fields, for example, between the lines

<input id="name" name="name" type="text" /> <br/>Phone number <br/>

以及

<input id="phone" name="phone" type="text" /> <br/>Year <br/>.

我该怎么办?

推荐答案

我会将您的行包装在标签中

I would wrap your rows in labels

<form action="doit" id="doit" method="post">
    <label>
        Name
        <input id="name" name="name" type="text" />
    </label>
    <label>
        Phone number
        <input id="phone" name="phone" type="text" />
    </label>
    <label>
        Year
        <input id="year" name="year" type="text" />
    </label>
</form>

并使用

label, input {
    display: block;
}

label {
    margin-bottom: 20px;
}

请勿使用br作为间距!

这篇关于表单域之间的间距的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆