效能
需注意幀率: 平均 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 並給出靜止畫面,保證文字清晰、控制元件可用鍵盤操作。請寫原創程式碼,不要從付費或受限的元件庫複製。
更完整的提示詞,包含調參、無障礙和接入步驟。