.btn-submit 優於 .btn-red。/ * 區塊 * /
.card { }
/ * 元素 * /
.card__title { }
.card__image { }
/ * 修飾詞 * /
.card--featured { }
.card__title--large { }
| 全寫 | 縮寫 | 適用場景 |
|---|---|---|
| setting / set | set | 設置相關 |
| success / suc | suc | 成功狀態 |
| hint / tip | hint | 提示訊息 |
| operation / op | op | 操作區塊 |
| password / pw | pw | 密碼欄位 |
| menu | menu / nav | 導航選單 |
| button / bt | btn | 按鈕 |
| text / tx | txt | 文字區塊 |
| color / c | clr | 顏色工具類 |
| background / bg | bg | 背景相關 |
| border / bor | bd | 邊框工具類 |
| center | ctr | 置中工具類 |
| icon | ico | 圖示 |
| popup / pop | pop | 彈層 |
/ * 輸入框 * /
.input-txt { }
.input-pw { }
.input-pw-login { }
/ * 提示訊息 * /
.hint-suc { }
.hint-suc-blogset { }
/ * 彈出層 * /
.pop-set { }
.pop-set-photo { }
/ * 通用工具類 * /
.hint-bg { }
.clr-txt { }
.clr-txt-p { }
若樣式永不變更(如清除浮動、對齊工具類),可使用外觀導向命名:
.align-left { float: left; margin-right: 20px; }
.align-right { float: right; text-align: right; margin-left: 20px; }
.clear { clear: both; text-indent: -9999px; }
使用時直接切換 class:<p class="align-left">...</p> → <p class="align-right">...</p>
採用 BEM + 語意化 + 團隊統一縮寫表,能讓 CSS 結構清晰、易擴展、低耦合,是大型專案長期維護的關鍵。