css - 我可以插入背景大小 : cover into the background shorthand?

标签 css

<分区>

我有这个:

background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;

我将 positionrepeat 折叠到 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/

上一篇:html - 使用 JQuery 重定向

下一篇:jquery dataTable 改变页面

相关文章:

html - 在页面中央显示菜单和 Logo

twitter-bootstrap - 如何在输入 Twitter Bootstrap 4 旁边放置按钮?

css - Chrome 中的位置固定中断,适用于 FF

javascript - 响应图像 slider 居中图像

html - 更改material-ui对话框显示的动画

CSS:按钮文本位于看似大于定义行高的底部

css - 无法在 wordpress 网站上加载资源 : the server responded with a status of 404 () + . ttf 文件

html - 将 Font Awesome 图标添加到 css 类

css - 为 Web 应用程序进行网格设计的注意事项

html - 不能在 flexbox 流中包装列,除非在 Chrome 下