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

如何为HR分隔器中间盒子添加16度侧边斜角并消除间隙

问题:为带hover动画的HR分隔器添加侧边斜角(除最外侧)

我制作了一个带有hover动画效果的HR分隔器,现在想为这些小盒子除最外侧两边外的侧边添加16度斜角,效果类似斜角拼接的盒子样式。尝试用clip-path实现时,相邻盒子间出现了空白间隙,目前陷入困境,希望能得到解决思路。

我的CSS代码如下:

.box {
  display: flex;
  width: 100%;
  height: 8px;
  margin: 5px 0px 60px 0px;
}

.box-sm {
  height: 15px;
  margin: 0;
  flex-grow: 1;
  transition: all .8s ease-in-out;
  cursor: pointer;
}

/*Growing the width of box, when hover using flex-grow property*/
.box-sm:hover {
  flex-grow: 12;
}

.bluewh1 {
  background-color: #4594d3;
}

.bluewh2 {
  background-color: #1ebcc5;
}

.bluewh3 {
  background-color: #84d0d9;
}

HTML代码如下:

<div class="box drop-shadow2">
   <div class="box-sm bluewh1"></div>
   <div class="box-sm bluewh2"></div>
   <div class="box-sm bluewh3"></div>
   <div class="box-sm bluewh2"></div>
   <div class="box-sm bluewh1"></div>
</div>

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.12 20:50:30