18910140161

css背景图片定位

2021-10-25 13:38:55

83

背景图默认平铺:

background-repeat: no-repeat;/*不平铺*/
                              /*repeat-x;沿X轴平铺*/
                              /*repeat-x;沿Y轴平铺*/

背景图片定位:

background-position: 100px 30px;/* X轴 Y轴 */
                               /* 20% 20%; 百分比的方式 */
                               /* left|center|right top|center|bottom */

背景中scroll的设置:

background-attachment: fixed;/* 固定背景图片,随滚动条拉动时背景不变 */
                                             /* scroll 默认滚动 */

复合样式(简化单一样式):

background: #ccc url(.../jpg) no-repeat center top fixed;
                  /* 颜色 背景图 是否平铺 背景图定位 scroll设置 */

 

相关文章
我们已经准备好了,你呢?
2024我们与您携手共赢,为您的企业形象保驾护航