我试图让这些输入字段响应居中,但我有点麻烦。有人能让我知道我可能会出错吗?我试图创建一个父div,然后容器元素,但不能“边距:0”似乎并没有工作。中央窗体输入响应
HTML
<div id="settings-info">
<div class="settings-info-container">
<form enctype="multipart/form-data" id="userUpdateForm">
<input type="text" id="userFnameValue" class="userInfoValues" placeholder="First Name"
value="{{ userSettings[0]['fName'] }}"/> <br>
<input type="text" id="userLnameValue" class="userInfoValues" placeholder="Last Name"
value="{{ userSettings[0]['lName'] }}"/> <br>
<input type="text" id="userLocalValue" class="userInfoValues" placeholder="Location"
value="{{ userSettings[0]['userLocation'] }}"/> <br>
<input type="text" id="userNameValue" class="userInfoValues" placeholder="UserName"
value="{{ userSettings[0]['userName'] }}"/><br>
<input type="text" id="userGenderValue" class="userInfoValues" placeholder="Gender"
value="{{ userSettings[0]['userGender'] }}"/> <br>
<input type="text" id="userEmailValue" class="userInfoValues" placeholder="Email"
value="{{ userSettings[0]['emailAddress'] }}"/><br>
<div id="info-pref-sub-btn">
<span id="info-pref-sub-text">Update Info</span>
</div>
</form>
</div>
</div>
CSS
#settings-info{
position: absolute;
top: 395px;
background-color: rgba(0, 0, 0, 0.84);
/*background-color: red;*/
width: 100%;
}
.settings-info-container{
position: relative;
width: 100%;
background-color: rgba(0, 0, 0, 0.84);
/*background: green;*/
}
.userInfoValues{
position: relative;
font-size: 120%;
text-align: center;
left: 9%;
width: 82%;
/*width: 250px;*/
height: 38px;
margin: 12px auto 18px;
border-radius: 8px;
border: 2px solid white;
opacity: 0.5;
background: #000;
color: white;
}
/*same as our access and details submit button...may want to put in a class*/
#info-pref-sub-btn {
position: relative;
width: 100%;
height: 60px;
color: white;
font-size: 145%;
font-weight: bold;
background-color: #0070a3;
border: 0;
border-radius: 1px;
text-align: center;
}
#info-pref-sub-text{
position: relative;
top: 30%;
}
查看代码什么不是中心?小提琴看起来不错 – Huangism
是吗?我在Chrome中运行它,而且在Chrome浏览器中看起来很好,但是在iphone5和6上它看起来很好,并且向右转。 – stingMantis