css之右上角带弧形的三角形标签文字45度倾斜显示

实现效果

 html

<div class="round-triangle"></div>
     <div class="myPoints_demo">
         <span class="points">12元</span>
     </div>
<div class="state">可提现</div>

css

.myPoints_demo{
    width: 460px;
    height: 80px;
    line-height: 80px;
    border-radius: 12px;
    background-color: #74B9E9; 
}

.points{
    margin-left:35px;
    color: white;
    font-weight:bolder;
    font-size:28px;
}

.state{
	width: max-content;
    color: #74B9E9;
    transform: rotate(45deg) translateY(-125px) translateX(33px);
    position: absolute;
    right: 147px;
    font-size: 12px;
}
    
/* 设置第一个圆角 */
.round-triangle{
    margin-left: 410px;
    width: 30px;
    height: 30px;
    position: absolute;
    background-color: #74B9E9;
    border-top-right-radius: 12px; 
}

/* 在首部和尾部添加两个绝对定位的图形覆盖部分上面图形设置剩下两个圆角 */
.round-triangle:before, .round-triangle:after{
    content:"";
    width: 30px;
    height: 30px;
    background-color: #fff;
    position: absolute;  
    margin-left: 20px;
}  

/* 设置旋转、缩放、倾斜和平移让两个伪元素边缘与上面图形边缘重合 */
.round-triangle:before{
    transform:rotate(-135deg) skewX(-45deg) scale(1.45,0.7) translate(0,-50%); 
} 

.round-triangle:after{
    transform:rotate(135deg) skewY(-45deg) scale(0.7,1.45) translate(50%,0);
}  

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值