性能
需注意帧率: 平均 42.4 fps,p5 29.9 · 长任务: 0 个,共 0 毫秒,最长 0 毫秒 · 源码 gzip 1.9 KB · 运行时 3.9 KB
blue-zebra-2MIT开关Uiverse.io
ilkhoeri 用纯 HTML 和 CSS 做的开关。按 MIT 许可从 Uiverse.io 收录,此处为实时预览。
质量报告
等级和分数来自构建或测试时跑过的自动检查。没跑过的项目会标成「未检测」,不会填假数据。
帧率: 平均 42.4 fps,p5 29.9 · 长任务: 0 个,共 0 毫秒,最长 0 毫秒 · 源码 gzip 1.9 KB · 运行时 3.9 KB
问题 0 · 读屏: 需注意
已响应减弱动效
无溢出
帧率和长任务是在无界面的 Chromium 里用软件 WebGL 测的,只适合在本站组件之间比较,不代表真机表现。
没有 axe-core 违规。

检测于 2026年11月15日 · 数据来自自动脚本,不是手工填写。
按实际尺寸显示。
复制内容以许可声明开头,使用代码时请保留。
<div class="switch-wrap">
<input
class="switch-input"
aria-label="switch"
name="switch"
id="switch"
type="checkbox"
hidden=""
/>
<label class="switch-label" for="switch"></label>
<span class="switch-marbles"></span>
</div>/* From Uiverse.io by ilkhoeri - Tags: switch */
.switch-wrap {
z-index: 20;
position: relative;
display: flex;
align-items: center;
justify-content: center;
border-radius: 9999px;
width: calc(var(--w-switch) + calc(var(--p) * 2));
height: calc(var(--h-switch) + calc(var(--p) * 2));
box-shadow: hsla(var(--pure-black), 0.25) 2px -5px 4px inset,
hsla(var(--pure-black), 0.25) 0px 2px 5px -1px,
hsla(var(--pure-black), 0.3) 0 1px 3px -1px,
0 70px 40px -20px hsla(var(--pure-black), 0.2),
hsla(var(--pure-black), 0.2) 0 0 0 1px inset;
--round: 4rem;
--pure-black: 0, 0%, 0%;
--pure-white: 0, 0%, 100%;
--scale-x: calc(1.35 * var(--round));
--p: calc(calc(6.25 / 100) * var(--round));
--checked: calc(100% - calc(var(--round) + var(--p)));
--sz-marbles: calc(var(--w-switch) + calc(var(--p) * 2));
--h-switch: calc(var(--round) + calc(var(--p) * 2));
--w-switch: calc(calc(var(--round) * 2) + calc(var(--p) * 2));
--bg-switch: var(--pure-black);
--box: var(--pure-white);
}
.switch-wrap .switch-input {
display: none;
background: transparent none;
visibility: hidden;
}
.switch-label {
cursor: pointer;
user-select: none;
position: relative;
z-index: 20;
width: var(--w-switch);
height: var(--h-switch);
display: flex;
align-items: center;
justify-content: center;
outline: none;
background-color: hsl(var(--pure-white));
border-radius: 9999px;
border-width: 0px;
transition: all linear 300ms;
box-shadow: var(--shadow);
--shadow: hsla(var(--pure-black), 0.4) 0 2px 4px,
hsla(var(--pure-black), 0.3) 0 7px 13px -3px,
hsla(var(--pure-black), 0.25) -2px -5px 4px inset,
hsla(var(--pure-black), 0.2) 0 0 0 1px inset;
}
.switch-label::after {
position: absolute;
display: block;
content: "";
width: var(--round);
height: var(--round);
left: var(--p);
border-radius: 9999px;
background-color: hsl(0, 0%, 100%);
will-change: left, width, margin, padding;
box-shadow: var(--shadow);
transition: left 300ms cubic-bezier(0.175, 0.885, 0.32, 1.275),
width 300ms ease, padding 300ms ease, margin 300ms ease,
background-color 300ms ease, box-shadow 300ms linear;
}
.switch-input + .switch-label:active::after {
width: var(--scale-x);
--shadow: hsla(var(--pure-black), 0.4) 0 2px 4px,
hsla(var(--pure-black), 0.3) 0 7px 13px -3px,
hsla(var(--pure-black), 0.25) 0px -2px 8px 6px inset,
hsla(var(--pure-black), 0.25) 0 0 0 1px inset;
}
.switch-input:checked + .switch-label {
--shadow: hsla(var(--pure-black), 0.4) 0 2px 4px,
hsla(var(--pure-black), 0.3) 0 7px 13px -3px,
hsla(var(--pure-black), 0.25) 2px -5px 4px inset,
hsla(var(--pure-black), 0.2) 0 0 0 1px inset;
--bg-switch: var(--pure-white);
--box: var(--pure-black);
}
.switch-input:checked + .switch-label::after {
background: white linear-gradient(-45deg, #f8acff 0%, #696eff 100%);
left: var(--checked);
}
.switch-input:checked + .switch-label:active::after {
margin-left: calc(calc(var(--checked) - var(--scale-x)) - var(--p));
}
.switch-marbles {
width: 100%;
height: 100%;
position: absolute;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
border-radius: 9999px;
}
.switch-marbles::after {
height: var(--sz-marbles);
width: var(--sz-marbles);
z-index: 0;
content: "";
position: absolute;
border-radius: 9999px;
}
.switch-marbles::before {
content: "";
height: var(--sz-marbles);
width: var(--sz-marbles);
position: absolute;
border-radius: 9999px;
z-index: -1;
background-image: linear-gradient(-45deg, #f8acff 0%, #696eff);
filter: blur(20px);
opacity: var(0.7);
animation: rotate 4000ms linear running infinite;
}
@keyframes rotate {
to {
rotate: 360deg;
}
}控件 · HTML · CSS · JS
直接改代码,再用控件微调,预览会随输入实时更新。

在线编辑每个组件,用控件微调,下载完整源码,复制进阶提示词。
一次性 $49占位价格
测试模式:不会真实扣款。
免费:预览、复制按钮和课程说明。
深深的内阴影轨道配上有光泽的旋钮,像一颗弹珠在凹槽里滚动,看起来很有实物感。
想要触感和质感的深色仪表盘、设置面板。
整体尺寸都由 --round(4rem)推算;--p 控制内边距,--pure-black 和 --pure-white 决定阴影和旋钮颜色。
用纯 HTML、CSS 和 JavaScript(不用框架)做一个「弹珠玻璃开关」组件。深深的内阴影轨道配上有光泽的旋钮,像一颗弹珠在凹槽里滚动,看起来很有实物感。 适用场景:想要触感和质感的深色仪表盘、设置面板。 开放这些可调项:整体尺寸都由 --round(4rem)推算;--p 控制内边距,--pure-black 和 --pure-white 决定阴影和旋钮颜色。 支持浅色和深色主题,遵守 prefers-reduced-motion 并给出静止画面,保证文字清晰、控件可用键盘操作。请写原创代码,不要从付费或受限的组件库复制。
更完整的提示词,包含调参、无障碍和接入步骤。