您当前的位置: 首页 >  小程序

培根芝士

暂无认证

  • 4浏览

    0关注

    446博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

小程序设置view渐变色

培根芝士 发布时间:2021-06-22 14:48:12 ,浏览量:4

  • 线性渐变(linear-gradient)

从上到下(默认)

.content {
    width: 240px;
    height: 240px;
    background: linear-gradient(red, blue);
}

 从左到右

.content {
    width: 240px;
    height: 240px;
    background: linear-gradient(to right, red, blue);
}

对角(从左上到右下)

.content {
    width: 240px;
    height: 240px;
    background: linear-gradient(to bottom right, red, blue);
}

指定角度

.content {
    width: 240px;
    height: 240px;
    background: linear-gradient(120deg, red, blue);
}

多个颜色的线性渐变

.content {
    width: 240px;
    height: 240px;
    background: linear-gradient(red, yellow, blue);
}

带透明度的线性渐变

.content {
    width: 240px;
    height: 240px;
    background: linear-gradient(rgba(255,0,0,0), rgba(255,0,0,1));
}

重复线性渐变(repeating-linear-gradient)

.content {
    width: 240px;
    height: 240px;
    background: repeating-linear-gradient(red, yellow 10%, green 20%);
}

 

  • 径向渐变(radial-gradient)

颜色结点均匀分布(默认)

.content {
    width: 240px;
    height: 240px;
    background: radial-gradient(red, green, blue);
}

颜色结点不均匀分布

.content {
    width: 240px;
    height: 240px;
    background: radial-gradient(red 5%, green 15%, blue 60%);
}

圆形径向渐变

.content {
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, red, yellow, green);
}

重复径向渐变(repeating-radial-gradient)

.content {
    width: 240px;
    height: 240px;
    background: repeating-radial-gradient(red, yellow 10%, green 15%);
}

 

关注
打赏
1660824269
查看更多评论
立即登录/注册

微信扫码登录

0.2344s