码迷,mamicode.com
首页 > Web开发 > 详细

css背景图片定位

时间:2018-01-02 23:20:33      阅读:281      评论:0      收藏:0      [点我收藏+]

标签:pos   ...   默认   简化   背景   复合   ack   jpg   nbsp   

背景图默认平铺:

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设置 */

 

css背景图片定位

标签:pos   ...   默认   简化   背景   复合   ack   jpg   nbsp   

原文地址:https://www.cnblogs.com/cjx-work/p/8179187.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!