【发布时间】:2015-08-16 00:14:57
【问题描述】:
我有一个注册表单,我想把它放在中间。但是,我的输入字段和按钮没有完全对齐。它们确实具有相同的尺寸。按钮宽了 5px,但是我也尝试了完全相同的宽度,但问题仍然存在。有人可以向我解释为什么会这样吗?我还想知道为什么提交按钮的宽度总是更小,即使它确实具有相同的值?该网站可以在 www.http://public-journalism.com/pages/sign_up.php
找到这是我的html代码:
<div id="pjsignup_container">
<form name="signup" method="post" action='/scripts/loginscript.php'>
Sign up
<br>
<input placeholder="Username" type='text' name='username' id='username' maxlength="50" />
<br>
<input placeholder="Email" type='text' name='email' id='email' maxlength="50" />
<br>
<input placeholder="Re-enter email" type='text' name='email' id='email' maxlength="50" />
<br>
<input placeholder="Password" type='password' name='password' id='password' maxlength="50" />
<br>
<input placeholder="Re-enter password" type='password' name='password' id='password' maxlength="50" />
<br>
<input type='submit' id="public_journalism_button" name='signup' value='Sign me up!'/>
<p>By signing up, you agree to our <a href="#">terms of use</a>, <a href="#">privacy policy</a>, <a href="#">and cookie policy</a>.</p>
</form>
</div>
这是我的css代码:
#pjsignup_container {
padding: 10px 0px 10px 0px;
}
#pjsignup_container input {
width: 220px;
height: 20px;
margin-top: 10px;
padding-left: 5px;
}
#pjsignup_container input[type=submit] {
width: 225px;
height: 30px;
color: white;
background-color: #0072C6;
border: 0px;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
}
【问题讨论】:
标签: html css forms button alignment