如何实现图片中所示的内凹圆角样式?

作者站长头像
站长
· 阅读数 10

这个样式有没有大佬提供下思路如何实现图片中所示的内凹圆角样式?

尝试过内凹圆角,还是不行

回复
1个回答
avatar
test
2024-06-19

简单写了一个,思路就是这样的 👇

answer image

右上角其实可以用渐变背景色实现会更加优雅一些,但有一个按钮在附近就省了这部分的,代码也更好理解一些。

🌰 CodePen Demo

<div class="demo">
  <div class="demo-container"></div>
  <div class="demo-arrow-btn"></div>
</div>
.demo
  width 300px
  padding-right 80px
  margin 20px
  position relative
  &-container
    height 140px
    background #f6f6f6
    border-radius 45px 45px 0 0 
    position relative
    &:before, &:after 
      width 80px
      height 80px
      content ''
      display block
      position absolute
      right 0
      transform translateX(100%)
    &:after
      width 30px
      height 30px
      background #f6f6f6
      bottom 60px
    &:before
      height 60px
      background #f6f6f6
      border-top-right-radius 45px 
      bottom 0
  &-arrow-btn
    width 70px
    height 70px
    background #f6f6f6
    border 10px solid white
    border-radius 50%
    position absolute
    right -9px
    top -9px
回复
likes
适合作为回答的
  • 经过验证的有效解决办法
  • 自己的经验指引,对解决问题有帮助
  • 遵循 Markdown 语法排版,代码语义正确
不该作为回答的
  • 询问内容细节或回复楼层
  • 与题目无关的内容
  • “赞”“顶”“同问”“看手册”“解决了没”等毫无意义的内容