我的输入字段名称和密码不会在中间对齐,有人可以帮帮我吗? 我已经添加了相关的HTML和CSS,希望你能找出所有的代码:p。 .................................................. ..................................
<div class="login">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="login_form">
<div class="loginfield"><input type="text" name="email" placeholder="Email" /></div>
<div class="loginfield"><input type="password" name="password" id="password" placeholder="Password" /></div>
<input type="submit" id="loginbutton" name="loginbutton" value="Login" data-role="" data-theme="" />
</form>
<p>Not a member? <a href="register.php">Sign up</a> now!</p>
</div>
CSS
.login input[type=password]{
background: url(../images/password.png) 6px 4px no-repeat, linear-gradient(to bottom, #f7f7f8 0%,#ffffff 100%);
background-size: 30px 30px;
border-radius: 3px;
border: 1px solid #fff;
box-shadow: 0 1px 2px rgba(0,0,0,0.2) inset, 0 -1px 0 rgba(0,0,0,0.05) inset;
transition: all 0.2s linear;
font-size: 16px;
color: #222222;
position: relative;
padding-left: 42px;
float:left;
margin-bottom: 10px;
margin-top: 10px;
height: 36px;
width: 200px;
@include breakpoint($tablet){
width:300px;
}
@include breakpoint($desktopsmall){
width:400px;
}
&::-webkit-input-placeholder {
color: #999999;
}
&:-moz-placeholder {
color: #999999;
}
&:focus{
box-shadow: 0 1px 0 #2392F3 inset, 0 -1px 0 #2392F3 inset, 1px 0 0 #2392F3 inset, -1px 0 0 #2392F3 inset, 0 0 4px rgba(35,146,243,0.5);
outline: none;
background: url(../img/keyIcon.png) 12px 11px no-repeat, #FFF;
}
}
.login input[type=text]{
background: url(../images/user.png) 6px 4px no-repeat, linear-gradient(to bottom, #f7f7f8 0%,#ffffff 100%);
background-size: 30px 30px;
border-radius: 3px;
border: 1px solid #fff;
box-shadow: 0 1px 2px rgba(0,0,0,0.2) inset, 0 -1px 0 rgba(0,0,0,0.05) inset;
transition: all 0.2s linear;
font-size: 16px;
color: #222222;
position: relative;
height: 36px;
width: 200px;
padding-left: 42px;
float:left;
margin-bottom: 10px;
margin-top: 10px;
@include breakpoint($tablet){
width:300px;
}
@include breakpoint($desktopsmall){
width:400px;
}
&::-webkit-input-placeholder {
color: #999999;
}
&:-moz-placeholder {
color: #999999;
}
&:focus{
box-shadow: 0 1px 0 #2392F3 inset, 0 -1px 0 #2392F3 inset, 1px 0 0 #2392F3 inset, -1px 0 0 #2392F3 inset, 0 0 4px rgba(35,146,243,0.5);
outline: none;
background: url(../img/keyIcon.png) 12px 11px no-repeat, #FFF;
}
}
答案 0 :(得分:1)
这很简单,您需要应用于所有输入,或指定类或ID
input{
text-align: center;
}
.text_center{
text-align: center;
}
查看此示例: http://jsfiddle.net/R85LS/