html中实现对角线颜色渐变,CSS3基础知识 - 对角线渐变色的几何图形

CSS

语言:

CSSSCSS

确定

.shape {

display: block;

height: 150px;

width: 150px;

color: #ffbb01;

}

.triangle {

background: transparent;

position: relative;

}

.triangle:before {

content: '';

display: block;

border: 150px solid transparent;

border-width: 150px 75px;

border-top-width: 0;

border-bottom-color: currentColor;

}

.triangle:after {

content: '';

position: absolute;

left: 0;

top: 0;

height: 100%;

width: 50%;

background: #ffcc01;

-webkit-clip-path: polygon(0px 150px, 75px 150px, 75px 0px);

clip-path: polygon(0px 150px, 75px 150px, 75px 0px);

}

.square {

background: -webkit-linear-gradient(315deg, #ffcc01, #ffcc01 50%, currentColor 50%, currentColor 100%);

background: linear-gradient(135deg, #ffcc01, #ffcc01 50%, currentColor 50%, currentColor 100%);

}

.circle {

border-radius: 50%;

background: -webkit-linear-gradient(left, #ffcc01, #ffcc01 50%, currentColor 50%, currentColor 100%);

background: linear-gradient(left, #ffcc01, #ffcc01 50%, currentColor 50%, currentColor 100%);

/* Stage Styles */

}

html,

body {

height: 100%;

}

body {

background: #f0f3f5;

margin: 0;

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

-webkit-align-items: center;

-ms-flex-align: center;

align-items: center;

-webkit-justify-content: center;

-ms-flex-pack: center;

justify-content: center;

}

.stage {

display: -webkit-flex;

display: -ms-flexbox;

display: flex;

width: 500px;

-webkit-align-items: center;

-ms-flex-align: center;

align-items: center;

-webkit-justify-content: space-between;

-ms-flex-pack: justify;

justify-content: space-between;

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值