1、html中将需要加背景图的div(other-product)包裹住定位文字的div(other-product-box)和遮罩层的div(indexInner)
2、设置最外边框CSS样式
.other-product{
position: relative;
background-size: 100%;
background-size: 100% 100%;
background-repeat: no-repeat;
min-height: 675px;
background-size: 100%;
}
3、设置遮罩层的CSS样式
.indexInner{
background: rgba(0,0,0,0.4);
height: 675px;
width: 100%;
position: absolute;
left: 0;
top: 0;
z-index: 2;
}
4、设置最上层文字div的CSS样式
.other-product-box{
position: absolute;
margin: 0 auto;
width: 100%;
-webkit-box-sizing: border-box;
padding: 0 10px;
z-index: 999;
max-width: 1180px;
left: 152px;
}
5、完结