我有一個div與背景圖像。 Div的寬度爲20% - 我希望它根據用戶分辨率改變其大小。問題是我無法強制背景圖像縮放約束比例。 此外,我有一個標籤 - 我想我被安置在第一個div的底部。背景圖像 - 約束比例
這是我想要完成的任務:
我的代碼:
<a href="">
<div class="box">
<div class="label">Beijing</div>
<div class="description">August 2014</div>
</div>
</a>
我的CSS:
.box {
float: left;
width: 19.60%;
margin-left:0.40%;
margin-top:10px;
text-align:center;
background-image: url("beijing.png");
background-size: cover;
}
.label {
font-size:28px;
color:#fff;
font-family:Roboto;
font-weight:300;
background-color: rgba(60, 60, 62, 0.5);
}
.description {
font-size:12px;
color:#fff;
font-family:Roboto;
font-weight:300;
background-color: rgba(60, 60, 62, 0.5);
text-transform:uppercase;
}
非常感謝 - 完美的工作 – t3x 2015-04-06 09:55:14