怎么让html的背景图片铺满整个显示器
想让html的背景图片铺满整个显示器,或者铺满宽度,并且宽度缩小时图片从两头同时开始隐藏,而不是只隐藏右边。方法很多,方法如下:
一、放大图片铺满屏幕。
方法一:需要先确定总高度。
background: url("../img/bj.jpg") no-repeat center; background-size: 100vw 100vh;
方法二:
background: url("../img/bj.jpg") no-repeat center; background-size: cover;
二、图片重复铺满全屏,默认即可。
background: url("../img/bj.jpg") ;
想到什么写什么,以后再补充其他方法。