#container { width: /* em values preferred */; max-width: 100%;}.any-internal { /* % values only */ }
A CSS “object” is a repeating visual pattern, that can be abstracted into an independent snippet of HTML, CSS, and possibly JavaScript. – Nicole Sullivan, OOCSS
SMACSS Based on Category Base (element type) Layout (use #id) Module (use .classes) State (use !important) Theme (i.e. “skin”)
sass/ tools/ config/ _colors.scss _fonts.scss _sizes.scss _index.scss initial/ patterns/ layouts/ components/ style.scss
<article-component data-scope='article'> <h2 data-scope='article'>...</h2> <sub-component data-scope='article' data-scope='sub'> <!-- internals of sub only have scope='sub' --> </sub-component> <footer data-scope='article'>...</footer></article-component>
<article data-scope="article instance-id"> h2[data-scope~=article] { /* all instances */ }h2[data-scope~=instance-id] { /* unique instance */ }
[data-attr] ➡ Presence (even if empty) [data-attr="..."] ➡ Exact match [data-attr*="..."] ➡ Any match [data-attr~="..."] ➡ Space-delimited (like classes) [data-attr|="..."] ➡ Hyphen-delimited [data-attr^="..."] ➡ Starts with… [data-attr$="..."] ➡ Ends with… [data-attr="..." i|s] ➡ Case sensativity