我試圖將兩個輸入字段並排放置在一起並水平居中。我有兩個問題,第一個問題是無論出於何種原因,這兩個輸入字段都會彼此重疊。中心兩個div並排接觸形式
最近我一直在解決這個問題,就是使用「box-sizing:border-box」,但不幸的是,刪除了填充並因此改變了設計。第二個問題是我需要兩個輸入字段在中心。
.quote-page .contact .box {
width: 70%;
}
.quote-page .contact .box .left {
float: left;
width: 50%;
}
.quote-page .contact .box .right {
float: left;
width: 50%;
}
.quote-page .form-2 {
position: relative;
border-radius: 4px;
background-color: rgba(255, 255, 255, 0.8);
color: rgb(77, 77, 77);
border: none;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
line-height: 1.42857143;
height: 30px;
width: 100%;
margin: 10px 0 10px 0;
padding: 6px 12px;
}
<div class="box">
<div class="left">
<input name="email" type="email" class="form-2">
</div>
<div class="right">
<input name="email" type="email" class="form-2">
</div>
</div>
下面是完整的腳本,所以你可以看到這個問題:
https://codepen.io/anon/pen/BdQqeN
謝謝了很多,感謝您詳細解釋,現在我明白爲什麼我這麼難過。 – Lavonen
非常歡迎。我還有其他的建議,但是我想提出的一個首要的建議是你考慮加入* {box-sizing:border-box; }。它會迫使你進行一些調整,但你會發現它更容易建立你的佈局。 @skribe –