使用 Anchor Positioning 连接圆圈 II

January 08, 2026

2026年1月8日

Improving the previous implementation to include the calculation of the distance between both circles inside the arrow shape.

改进之前的实现,以在箭头形状内部包含两个圆圈之间距离的计算。

CSS-only connected circles with distance

Still the same code structure

仍然是相同的代码结构

<div class="circle" name="--a" size="150px"></div><div class="circle" name="--b" size="100px"></div><div class="arrow" x="--a" y="--b" size_x="150px" size_y="100px"> ...</div>
.arrow {  --r: 25px; --a: 40deg; --d: 5px;  --g: 10px;  --c: #556270;}

Drag the circles in the demo below and see how the value updates:

拖动下方演示中的圆圈,查看值如何更新:

⚠️ Chrome-only for now ⚠️

⚠️ 目前仅限 Chrome ⚠️

And another demo with more than two circles

以及另一个带有超过两个圆圈的演示

开通本站会员,查看完整译文。

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.148.4. UTC+08:00, 2026-01-24 19:36
浙ICP备14020137号-1 $mapa de visitantes$