css Background写的先后顺序问题

问题代码:

background-size: cover;
background: url("../images/1.jpg") no-repeat center 0;

如上所示,background-size: cover;不生效

解决办法:

background: url("../images/1.jpg") no-repeat center 0;
background-size: cover;

使用background的简写属性,顺序在background-size..之后,会覆盖之前的

猜你喜欢

转载自blog.csdn.net/weixin_38128649/article/details/126482553