多级背景图的层叠设计 backgroundImage

        在开发中,需要给一个区域设置多套 背景图或者背景色。

1 花在上,背景图在下,backgroundImage 第一个放置花,再放置色值,效果如下:

.back-bg{
    margin-top:30px;
    height:300px;
    background-image:  url('https://www.w3cschool.cn/statics/images/course/img_flwr.gif'),
    linear-gradient(to right,red 0%,blue 50%,yellow 100%);
    background-repeat: no-repeat, no-repeat;
    background-size:350px 200px,100% 50%;
    background-position:right 20px top 20px,left bottom;
 }

2 将上述  url及对应的size,position 调整,则背景色覆盖在花之上,效果如下:

background-image:  linear-gradient(to right,red 0%,blue 50%,yellow 100%),
 url('https://www.w3cschool.cn/statics/images/course/img_flwr.gif');
background-repeat: no-repeat, no-repeat;
background-size:100% 50%,350px 200px;
background-position:left bottom,right 20px top 20px;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值