📏 Spacing Scale Generator
📐 工作原理與說明
間距 s(n) = base × rⁿ(等比)或 base × n(線性,如 4/8/12/16)
基於模數化間距體系:以一個基數按固定比例或倍數派生整組間距,保證頁面留白節奏一致;輸出為 CSS 變數,用於設計規範與元件間距。
Generate a consistent spacing ladder from a base unit such as 4/8/16 multiples and copy it as CSS variables for design systems.
📚 深度解析:間距比例尺
💡 常見使用場景
- 統一元件間距。
- 設計系統 token。
- 柵格留白。
生成 4 倍數列
輸入:基 4、檔 8。
處理:生成比例。
輸出:--space-1…8 變數。
❓ 常見問題(FAQ)
- 基值怎麼選?
- 4/8 常見;與元件高度對齊更協調,按體系定。
- 負間距怎麼處理?
- 間距用正 token;需要重疊時用 margin 負值,不要借間距 token 表達。
- 會儲存或上傳我的內容嗎?
- 結果以瀏覽器即時計算為準,純前端本地處理、資料不上傳;生成的樣式與程式碼僅作快速產出參考,正式專案請以設計系統、規範與瀏覽器實測為準。
Formula & Standard References
| Item | Formula / Note | Source / Standard |
|---|---|---|
| Base grid | multiples of 4 or 8 px keep components aligned | Design practice |
| Scale steps | step spacing by 1.5 or 2 so adjacent sizes stay distinct | Modular scale convention |
| Margin collapsing | vertical margins of adjacent blocks collapse to the larger value | CSS 2.1 (8.3.1) |
⚠️ 使用說明與注意事項
- 本工具純前端執行,資料不會上傳到伺服器
- 建議在主流瀏覽器(Chrome/Safari/Firefox/Edge)中使用
- 計算結果僅供參考,請以實際應用場景為準