我有一个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