html背景图片设置百分比

版权声明:本文为博主原创文章,未经博主允许不可转载。转载请注明出处 https://blog.csdn.net/qq_32442967/article/details/83268313

html背景图片设置百分比

     background-size: cover;
    //把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。
    //背景图像的某些部分也许无法显示在背景定位区域中。
    background-size: contain;
    //把图像图像扩展至最大尺寸,以使其宽度和高度完全适应内容区域。
body, html {
    height: 100%;
    width: 100%;
    background-image: url(img/bg.png);
    background-size: cover;
    background-repeat: no-repeat;			//背景图片不重复
}

https://www.foryh.com

猜你喜欢

转载自blog.csdn.net/qq_32442967/article/details/83268313