黄子涵

查漏补缺——解释一下以下样式

问题

如题所示

background-position: center center;
                background-repeat: no-repeat;
                background-attachment: fixed;
                background-size: cover;

答案

CSS 背景位置 background-position属性

background-position: center center;表示图像水平方向和垂直方向居中对齐。

CSS 背景重复 background-repeat属性

background-repeat: no-repeat;表示图像只显示一次。

CSS background-attachment属性

background-attachment: fixed;表示图像附着在浏览器的可视区域。

background-size中,100%和cover的区别

background-size: cover;表示图像会缩放适合容器的大小,图像比例不变。

posted @ 2022-07-05 20:15  黄子涵  阅读(35)  评论(0编辑  收藏  举报