0
這是我想達到的佈局:與DIVS +形象定位響應式佈局
這是我目前的HTML + CSS(我剛學很抱歉,如果它的重複性和關閉:))
<div class="collection clearfix">
<div class="image-left1"> </div>
<div class="icon-left1">
<img src="images/mainLP-chair-icon.png" alt="Chair Collection">
<p>Chair Collection</p>
</div>
</div>
<div class="collection clearfix">
<div class="icon-right1">
<img src="images/mainLP-lamp-icon.png" height="48" width="34" alt="Lamp Collection">
<p>Lamp Collection</p>
</div>
<div class="image-right1"> </div>
</div>
...它交替總計層疊5周的div。
和CSS是:
/* =================== Main Section =================== */
.collection {
padding-top: 25px;
}
/*=================== CHAIRS ===================*/
.image-left1 {
background: url(../images/mainLP-chairs.jpg) center;
height: 570px;
width: 70%;
display: inline-block;
}
.icon-left1 {
float: right;
width: 30%;
background-color: #c7db9c;
padding: 10px;
border-left: 25px solid white;
height: 570px;
}
.icon-left1 p {
text-transform: uppercase;
font-family: 'Roboto Slab', serif;
color: #fff;
font-weight: 400;
font-size: 14px;
position: relative;
top: 220px;
left: 36px;
}
.icon-left1 img {
border: 0;
position: relative;
top: 222px;
left: 76px;
}
/*=================== LAMPS ===================*/
.image-right1 {
background: url(../images/mainLP-lamps.jpg) center;
height: 570px;
width: 70%;
display: inline-block;
}
.icon-right1 {
float: left;
width: 30%;
background-color: #f4dc86;
padding: 10px;
border-right: 25px solid white;
height: 570px;
}
.icon-right1 p {
text-transform: uppercase;
font-family: 'Roboto Slab', serif;
color: #fff;
font-weight: 400;
font-size: 14px;
position: relative;
top: 220px;
left: 36px;
}
.icon-right1 img {
border: 0;
position: relative;
top: 222px;
left: 93px;
}
.wrapper {
width: 70%;
margin: 0 auto;
} (This is around everything)
我不關心另外一個關於響應,但我應該是在路上。我看到一些問題。
每個容器的背景圖片尺寸不正確 - 它會被切斷。我將如何解決這個問題?
必須有一個更好的方式來漂浮圖像旁邊的圖標和文本../現在它是不可靠和定位相對,我認爲是不正確的。或者如果它是正確的我想我已經編寫它錯了。
你可以在圖像背景上使用'background-size:cover' –
我試過了,它似乎沒有什麼區別。 (還是)感謝你的建議。 – user5371630
你是什麼意思「它正在被切斷」?它是不是擴大到適合寬度?還是它增長過多,有些部分是隱藏的?它如何失敗? –