CSS3基础:background背景

<style>
        body{
            background-color: aliceblue;
            background-image: url(image/bg22.png);
            background-repeat: no-repeat;
            background-position: top center;
            background-attachment: fixed;
            background: rgba(0,0,0,0.3);
        }

    </style>

            background-color:   背景颜色
            background-image:   图片位置
            background-repeat: 插入的图片是否重复堆叠 ,可以是no-repeat  repeat  repeat-x  repeat-y
            background-position: 图片的位置,可以写top center left right buttom 等 顺序可以乱,但是如果要写精确位置,必须按照 x方向,y方向顺序写,例如12px 24px,表示图片距离左边边界12px,距离上面边界24px
            background-attachment: fixed;滚动页面时,图片是否固定。scroll(滚动)  fixed(固定)
            background: rgba(0,0,0,0.3);第四个数字处在(0,1)之间设置透明度

也可以写的简单一点:

        body{

            background: aliceblue url(image/11.jpg) no-repeat top center  fixed ;
        }

顺序可以乱

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值