HTML 中要设置背景的块大小 比如div 300px * 400px
那么背景图的最佳尺寸也是 300px 400px
然后设置 background: url(imgs/your.jpg) no-repeat center center;
背景水平垂直居中,效果最佳
背景图无论是缩放还是扩展,都会失真变得模糊,所以尺寸最接近块的大小最好
本回答被网友采纳加一个半透明遮罩
.bg-blur {
float: left;
width: 100%;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
-webkit-filter: blur(15px);
-moz-filter: blur(15px);
-o-filter: blur(15px);
-ms-filter: blur(15px);
filter: blur(15px);
}
.content-front {
position:absolute;
left: 10px;
right: 10px;
height:600px;
line-height: 600px;
text-align: center;
}
转自csdn: 网页链接,注意要孤立背景的div
追问怎么加
追答就把背景的diiv的class="上面的css标签"