【发布时间】:2014-06-03 06:47:10
【问题描述】:
我有一个小提琴here。
CSS:
body, html{
background: url("http://i62.tinypic.com/25qdg86.png") no-repeat center center fixed;
background-repeat:no-repeat;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size:100% 100%;
}
#img {
width:70%;
display:inline-block;
background-color:red;
position:absolute;
bottom:12%;
height:70%;
margin-top:-80px;
margin-left:100px;
}
HTML:
<div id="img"> </div>
是否可以使名为#img 的id 标记看起来像是固定在背景中?
我只是想让蓝色盒子之间的红色块流动(看看小提琴)。
因此,如果您调整页面的分辨率,红色块在高度方面不会超出蓝色框,但它会在宽度方面超出蓝色框。
所以基本上我想确保红色块 (#img) 保持在背景图像上的蓝色框内。我该怎么做?
【问题讨论】:
标签: html css fluid-layout