用一张插入图在页面中居中制作通栏banner,想让插入图之外的其他宽度区域添加上其他背景颜色,但是直接添加不行。如果用min-width的话,只有插入图右边的部分可以添加,插入图左边还是没有背景颜色,应该怎么操作?谢谢!
banner在浏览器中效果如下:
代码如下:.banner{
height: 323px;
position: relative;
}
.banner ul li{
height: 323px;
position: absolute;
top: 0;
left: 50%;
margin-left: -674px;
display: none;
min-width:100%;
background-color: yellow;
}
.banner ul li.current{
display: block;
}
经过试验,把定位给img而不是li就可以啦。