性能
通过帧率: 平均 60 fps,p5 59.9 · 长任务: 0 个,共 0 毫秒,最长 0 毫秒 · 源码 gzip 1.4 KB · 运行时 2.4 KB
wise-bobcat-72MIT开关Uiverse.io
Charly-T 用纯 HTML 和 CSS 做的开关。按 MIT 许可从 Uiverse.io 收录,此处为实时预览。
质量报告
等级和分数来自构建或测试时跑过的自动检查。没跑过的项目会标成「未检测」,不会填假数据。
帧率: 平均 60 fps,p5 59.9 · 长任务: 0 个,共 0 毫秒,最长 0 毫秒 · 源码 gzip 1.4 KB · 运行时 2.4 KB
问题 0 · 读屏: 通过
没有持续动效
无溢出
帧率和长任务是在无界面的 Chromium 里用软件 WebGL 测的,只适合在本站组件之间比较,不代表真机表现。
不适用:静止时没有可见动画;由悬停触发的动画没有测试。
没有 axe-core 违规。

检测于 2026年11月15日 · 数据来自自动脚本,不是手工填写。
按实际尺寸显示。
复制内容以许可声明开头,使用代码时请保留。
<div class="switch">
<input type="checkbox">
<div class="left"></div>
<div class="right"></div>
<div class="switcher"></div>
</div>/* From Uiverse.io by Charly-T - Tags: switch */
.switch {
--switch-width: 3.5em;
--switch-height: calc(var(--switch-width) / 2);
--left-ball-color: black;
--right-ball-color: white;
width: var(--switch-width);
height: var(--switch-height);
border-radius: calc(var(--switch-height) / 2);
background-color: var(--left-ball-color);
position: relative;
overflow: hidden;
}
.switch input[type="checkbox"] {
width: 100%;
position: absolute;
height: 100%;
margin: 0;
opacity: 0;
}
.switch .left {
position: absolute;
width: calc(var(--switch-width) / 3);
height: calc(var(--switch-height) / 1.5);
background-color: var(--left-ball-color);
border-radius: 50%;
left: calc((var(--switch-height) - (var(--switch-height) / 1.5)) / 2);
top: calc((var(--switch-height) - (var(--switch-height) / 1.5)) / 2);
z-index: 2;
pointer-events: none;
}
.switch .right {
position: absolute;
width: calc(var(--switch-width) / 3);
height: calc(var(--switch-height) / 1.5);
background-color: var(--right-ball-color);
border-radius: 50%;
right: calc((var(--switch-height) - (var(--switch-height) / 1.5)) / 2);
top: calc((var(--switch-height) - (var(--switch-height) / 1.5)) / 2);
z-index: 2;
pointer-events: none;
}
.switch .switcher {
position: absolute;
width: calc(100% + var(--switch-width) / 3);
height: 100%;
background-color: var(--right-ball-color);
z-index: 1;
left: calc(-50% + var(--switch-width) / (3 * 2));
pointer-events: none;
transition: left 500ms ease;
border-top-left-radius: calc(var(--switch-width) / 3);
border-bottom-left-radius: calc(var(--switch-width) / 3);
}
.switch .switcher:before {
position: absolute;
content: '';
width: calc(var(--switch-width) / 3);
height: 100%;
background-color: var(--left-ball-color);
display: block;
border-bottom-right-radius: 50%;
border-top-right-radius: 50%;
z-index: 2;
}
.switch .switcher:after {
position: absolute;
content: '';
width: calc(var(--switch-width) / 3);
height: 100%;
background-color: var(--right-ball-color);
display: block;
border-bottom-left-radius: 50%;
border-top-left-radius: 50%;
}
.switch input:checked ~ .switcher {
left: 100%;
}
.switch input:checked ~ .switcher:before {
display: none;
}控件 · HTML · CSS · JS
直接改代码,再用控件微调,预览会随输入实时更新。

在线编辑每个组件,用控件微调,下载完整源码,复制进阶提示词。
一次性 $49占位价格
测试模式:不会真实扣款。
免费:预览、复制按钮和课程说明。
滑块移动时,胶囊里的黑球和白球互换位置,用利落的双色方式切换模式。
主题切换和极简黑白网站。
设置 --switch-width(3.5em)、--left-ball-color(black)和 --right-ball-color(white);高度跟着宽度变。
用纯 HTML、CSS 和 JavaScript(不用框架)做一个「黑白阴阳开关」组件。滑块移动时,胶囊里的黑球和白球互换位置,用利落的双色方式切换模式。 适用场景:主题切换和极简黑白网站。 开放这些可调项:设置 --switch-width(3.5em)、--left-ball-color(black)和 --right-ball-color(white);高度跟着宽度变。 支持浅色和深色主题,遵守 prefers-reduced-motion 并给出静止画面,保证文字清晰、控件可用键盘操作。请写原创代码,不要从付费或受限的组件库复制。
更完整的提示词,包含调参、无障碍和接入步骤。