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

如何使用CSS实现两条斜向弯曲线条效果

用CSS实现两条斜向虚线曲线

我想要使用CSS制作两条斜向曲线。
我预期实现的效果如下:
预期曲线效果
目前我已实现的效果如下:
已尝试实现的曲线效果
我尝试使用border属性实现该效果,目前编写的代码如下:

.bottom-circle {
  width: 45%;
  height: 50px;
  border-bottom-left-radius: 100px;
  border-bottom-right-radius: 100px;
  border-left: 2px dashed #c6c6c6;
  border-right: 2px dashed #c6c6c6;
  margin: 0 auto;
}
<div class="bottom-circle"></div>

我已经花费数小时尝试调整但仍未达到预期效果,请问有什么最简单的实现方式吗?


你之前的写法只给元素底部设置了圆角,且仅添加了左右两侧的边框,所以最终呈现的是向下凹陷的底部曲线。最简单的改法不需要修改CSS即可,不用调整原有HTML结构完全不用改:

.bottom-circle {
  position: relative;
  width: 45%;
  height: 50px;
  margin: 0 auto;
}
/* 左侧曲线 */
.bottom-circle::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
  border-top-right-radius: 100px;
  border-top: 2px dashed #c6c6c6;
  border-right: 2px dashed #c6c6c6;
  box-sizing: border-box;
}
/* 右侧曲线 */
.bottom-circle::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 50%;
  height: 100%;
  border-top-left-radius: 100px;
  border-top: 2px dashed #c6c6c6;
  border-left: 2px dashed #c6c6c6;
  box-sizing: border-box;
}

如果需要调整曲线的弧度,直接修改border-radius的数值即可,数值越大曲线弧度越平缓,数值越小弧度越陡峭。如果需要调整两条曲线的间距,修改.bottom-circle的宽度即可。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.09.28 14:54:03