You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:CSS实现带弧形末端的圆形边框

实现带弧形末端的圆形边框效果

嘿,我懂你要的那种流畅弧形效果了!你的现有代码已经搭好了基础框架,但要实现带弧形末端的圆形边框(以及和底部栏的无缝衔接),我们可以通过调整border-radius的复合值加上伪元素来搞定,下面是具体方案:

解决方案代码

HTML结构保持不变,修改后的CSS如下:

.bottom-bar {
  background: #29a7e8;
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 50px;
  text-align: center;
  /* 给底部栏左右两端添加上方弧形末端 */
  border-top-left-radius: 30px 25px;
  border-top-right-radius: 30px 25px;
}

.circle {
  display: inline-block;
  position: relative;
  top: -30px; /* 调整位置让圆形更多露出栏外 */
  border-radius: 50%;
  background: #29a7e8;
  width: 60px;
  height: 60px;
  margin: 0 1rem;
  /* 添加圆形的边框(如果需要的话) */
  border: 3px solid #fff;
}

/* 给圆形添加底部弧形末端,和底部栏无缝衔接 */
.circle::before {
  content: "";
  position: absolute;
  bottom: -3px; /* 和圆形边框对齐 */
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 12px;
  background: #29a7e8;
  /* 弧形末端的圆角 */
  border-radius: 0 0 20px 20px;
  /* 保持边框一致 */
  border-bottom: 3px solid #fff;
}

效果说明

  1. 底部栏的弧形末端:
    用border-top-left-radius: 30px 25px这种复合值,第一个数值是水平方向的圆角半径,第二个是垂直方向的半径,这样就能做出向上弯曲的弧形,刚好和圆形的弧度(直径60px,半径30px)匹配,不会显得突兀。

  2. 圆形的弧形末端:
    通过::before伪元素创建一个小的弧形块,颜色和底部栏一致,并且带有和圆形相同的边框,这样看起来就像是圆形边框向下延伸出的弧形末端,完美衔接到底部栏上。

自定义调整

你可以根据自己的需求修改这些参数:

  • 调整border-top-left-radius和border-top-right-radius的数值,改变底部栏弧形末端的弯曲程度
  • 修改伪元素的width、height和border-radius,调整圆形末端弧形的大小和弧度
  • 替换background和border的颜色,匹配你的网站主题

内容的提问来源于stack exchange,提问作者Yung Silva

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 06:26:40