3 回答

TA贡献1797条经验 获得超6个赞
background: url(image.jpg) fixed 50%;
background-size: cover; /* PS: Use separately here cause of Safari bug */
的fixed(背景附件)是可选的。
以上只是以下内容的简写:
background-image : url(image.jpg);
background-attachment : fixed;
background-position : 50% 50%; /* or: center center */
background-size : cover; /* CSS3 */
您可以在所有现代浏览器中使用,但Safari可以使用:
background: url(image.jpg) fixed 50% / cover;
其中/在后台速记用于分离和区分position从size(原因位置接受单个和多个(X,Y)的值),但野生具有与该一个错误/速记所以使用如上所述。

TA贡献1783条经验 获得超4个赞
background-size: 100% 100%;
background-position: top left;
background-repeat: no-repeat;
应该可以。注意-您可以组合位置并重复到初始背景属性中
并申请
html, body { min-height: 100%; min-width: 100%; }
添加回答
举报