.widget-heading),BEM 修飾詞用雙連字號(.widget--large).widget {
padding: 10px;
border: 1px solid #BADA55;
background-color: #C0FFEE;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.widget-heading {
font-size: 1.5rem;
line-height: 1;
font-weight: bold;
color: #BADA55;
margin-right: -10px;
margin-left: -10px;
padding: 0.25em;
}
觀察重點:
.widget-heading 縮進一級 → 暗示它是 .widget 的子元素border-radius: 4px重複性高、屬性單一的工具類:
.t10 { width: 10%; }
.t20 { width: 20%; }
.t25 { width: 25%; } /* 1/4 */
.t33 { width: 33.333%; } /* 1/3 */
.t50 { width: 50%; } /* 1/2 */
.t66 { width: 66.666%; } /* 2/3 */
.t75 { width: 75%; } /* 3/4 */
.t100 { width: 100%; }
優點:極度緊湊,適合網格系統、間距工具類。
display, position, top/right/bottom/left, z-index, float, flex/grid 相關width, height, margin, padding, border, box-sizingfont, color, text-align, line-height, text-transformbackground, box-shadow, opacity, transform, transition, animationcursor, pointer-events, user-selectorder/properties-alphabetical-order 或自訂分組)div.card → .card)?