我怎样才能对齐input
元素,或者忽略这样的事实:input
元素的位置是根据元素前面p
元素的长度设置的?对齐HTML文档上的输入元素
.netconf>input {
margin-left: 6em;
display: inline;
}
<div id="ip" class="netconf">
<p>IP Address</p>
<input type="text" name="ipaddress" placeholder="XXX.XXX.XXX" />
</div>
<div id="netmask" class="netconf">
<p>Netmask</p>
<input type="text" name="netmask" placeholder="XXX.XXX.XXX" />
</div>
<div id="gateway" class="netconf">
<p>Gateway</p>
<input type="text" name="gateway" placeholder="XXX.XXX.XXX">
</div>
<div id="hostname" class="netconf">
<p>Hostname</p>
<input type="text" name="hostname" placeholder="Whatever" />
</div>
试试这个?改变“margin-left:6em;”到“margin-left:0em;” – SED