【小技巧】background-size不起作用

background-size:;失效多半是顺序错误导致,应该放在background:;下面

❌错误写法:

.test {
	width: 100px;
	height: 100px;
	background-size: 100%;	/*无效*/
	background: url('../img/test.jpg') no-repeat;
}

✅正确写法:

.test {
	width: 100px;
	height: 100px;
	background: url('../img/test.jpg') no-repeat;
	background-size: 100%;
}

版权声明:本文为weixin_45389633原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。