<分区>
标签 css
<分区>
我有这个:
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
我将 position
和 repeat
折叠到 background
中,但最终结果导致 background-size 属性被覆盖:
background-size: cover;
background: no-repeat 50% 50%;
是否可以将 folder background-size: cover 简写?我尝试了 background: no-repeat cover 50% 50%
但那是无效的。
最佳答案
我认为您不能在速记中包含 background-size
,但在速记语句之后包含它应该没有问题。
编辑:这answer确认您可以。
background: no-repeat 50% 50% etc;
background-size: cover;
简写语句覆盖所有背景语句,即使是那些没有包含(或不能包含)在简写语句中的语句。
关于css - 我可以插入背景大小 : cover into the background shorthand?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30841032/