黄子涵

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

问题

如题所示

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 @   黄子涵  阅读(44)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示