屬性順序固定後,尋找特定屬性變成 O(1) 視覺搜尋,減少認知負荷,尤其在大型規則集中效果顯著。
/* 未排序 - 難快速找到 margin-right */
div#header h1 {
z-index: 101;
color: #000;
position: relative;
line-height: 24px;
margin-right: 48px;
border-bottom: 1px solid #dedede;
font-size: 18px;
}
/* 字母排序 - 一眼定位 */
div#header h1 {
border-bottom: 1px solid #dedede;
color: #000;
font-size: 18px;
line-height: 24px;
margin-right: 48px;
position: relative;
z-index: 101;
}
order/properties-alphabetical-order。css 解析器可自動排序(需啟用相關選項)。無論採用字母序、分組序(佈局→盒模型→文字→裝飾)或其他,關鍵在於全專案統一並納入 CI 檢查。