CSS3中背景颜色的渐变

CSS3中背景颜色的渐变

1.线性渐变

语法:background:gradient (有兼容性问题 -moz- -webkit-)


1.

    div{
      width:500px;
      height:500px;
     background:-webkit-gradient(linear,0 0,0 100%,from(#f00),to(#00f);
  background:-webkit-gradient(linear,0 0,0 100%,from(#f00),to(#00f);
  background:-webkit-gradient(linear,left top,left bottom,from(#f00),to(#00f);
    }

在这里插入图片描述
2.

div{
 width: 500px;
  height:500px
  background:-webkit-gradient(linear,0% 0%,100% 100%,color- stop(0.1,rgb(255,0,0)),color-stop(0.5,rgb(255,255,0)),color-stop(1,rgb(0,0,255))); }

在这里插入图片描述
3.

div{
 width: 500px;
  height:500px;
   background: -webkit-linear-gradient(top,red,white,blue);
    background: -moz-linear-gradient(top,red,white,blue); }

在这里插入图片描述

2.径向渐变
div{ width: 500px;
 height:500px;
 background: -webkit-radial-gradient(50% 50%,black,white,blue);
  background: -moz-radial-gradient(50% 50%,black,white,blue); }

在这里插入图片描述

3.重复性渐变

background:repeating-radial-gradient(center,shape size, start-color, …, last-color)重复径向渐变

div{ width:200px; height:200px; padding: 20px; background:-webkit-repeating-radial- gradient(circle contain,#f00,#ff0 10%,#f00 15%) }

在这里插入图片描述

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值