CSS 背景background,精灵spirit(移动背景图位置来实现)

CSS背景background
background-color:
背景色,英文单词或十六进制颜色都可以。
background-image:url(图片路径 )背景图
background-repeat:(no-repeat不重复,repeat-x,repeat-y)重复

background-position:(left,center top bottom right) 背景图定位。(left top 表示左上角。right bottom 表示右下角。center 中间。left 20px 表示左边,向下移动20像素。 -30px -20px 表示向左移动30px,向上移动20px (spirit精灵就是通过移动背景图(大的背景图中有很多小的图)的位置来实现的,通常都是负数))

如:a{ width:110px;height: 40px;background:url(bg1.png) no-repeat -20px -50px; display:block;}    /* <a>标签是行内元素,width和height属性不起作用。加上display:block; 指定为块元素,width和height属性才会生效 */

background-attachment: (依附方式)是否固定,fixed
如: .box{background:#ccc url(图片的路径) no-repeat 定位坐标 fixed }



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值