🔘 CSS Button Generator
📐 工作原理與說明
從背景色十六進位制串取 R = slice(1,3)、G = slice(3,5)、B = slice(5,7) 按 16 進位制解析;按鈕樣式:padding = 縱向 px 橫向 px、background 取背景色、color 取文字色、border = 邊框寬 px solid 邊框色、border-radius = 圓角 px、font-size = 字號 px、box-shadow = 陰影X px 陰影Y px 模糊 px rgba(R,G,B,0.4);懸停態上移 2px 且陰影改為 陰影Y+2 / 模糊+4、透明度 0.5
把背景、圓角、內邊距、陰影與懸停態引數拼裝為完整 CSS 規則(含 :hover 偽類),即時預覽並可複製;用於快速產出風格統一的按鈕樣式。
Style a button background, radius, shadow and hover state visually and copy the generated CSS, with several built-in presets.
📚 深度解析:按鈕生成器
💡 常見使用場景
- 快速產出 CTA 按鈕樣式。
- 統一一套按鈕變體(主/次/幽靈)。
- 做郵件或落地頁按鈕。
生成橙色主按鈕
❓ 常見問題(FAQ)
- 懸停態怎麼處理?
- 生成 :hover 的明度/位移變化,可直接用。結果以瀏覽器即時計算為準,純前端本地處理、資料不上傳;生成的樣式與程式碼僅作快速產出參考,正式專案請以設計系統、規範與瀏覽器實測為準。
- 生成的程式碼/圖片能直接用嗎?
- 可直接複製使用,建議粘到專案後在瀏覽器實測微調;本工具只生成不託管。
- 會儲存或上傳我的內容嗎?
- 結果以瀏覽器即時計算為準,純前端本地處理、資料不上傳;生成的樣式與程式碼僅作快速產出參考,正式專案請以設計系統、規範與瀏覽器實測為準。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Box model | width = content + padding + border unless box-sizing is border-box | CSS Box Model Level 3 |
| Text contrast | label contrast of at least 4.5:1 against the fill | WCAG 2.2 (1.4.3) |
| Target size | pointer targets should be at least 24 x 24 px | WCAG 2.2 (2.5.8) |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準