微信小程序自定义圆弧背景

47 篇文章 8 订阅

1.实现效果

加粗样式

2.实现原理

方法一:设置伪元素after,根据需要的弧度,设置圆的宽度。圆的高度越高,幅度越大。
方法二:利用margin-left和margin-top将一个完整的圆移出去相应的位置。
本文采用的是方法一!

3.完整代码(更多小程序代码请移步码云)

https://gitee.com/susuhhhhhh/wxmini_demo

4.部分代码

.head_top{
  width: 100%;
  height: 100rpx;
  position: relative;
  z-index: -1;
  overflow: hidden;
}
.head_top::after{
  content: '';  
  width: 140%;
  height: 100rpx;
  position: absolute;
  z-index: -1;
  left: -20%;
  top: 0;
  border-radius: 0 0 50% 50%;
  background: #a4d1eb;
}
.head_top{
  width: 100%;
  height: 300rpx;
  position: relative;
  z-index: -1;
  overflow: hidden;
}
.head_top::after{
  content: '';  
  width: 140%;
  height: 300rpx;
  position: absolute;
  z-index: -1;
  left: -20%;
  top: 0;
  border-radius: 0 0 50% 50%;
  background: #e0bbc3;
}
  • 1
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值