Performance: CSS syntax and rules
This affects how quickly the browser can parse and apply styles, impacting page load and rendering speed.
Jump into concepts and practice - no test required
.nav-link:hover { color: red; }
div > ul > li > a:hover { color: red; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Deep complex selectors | High (many matches) | Medium (style recalculation) | Medium | [X] Bad |
| Simple class selectors | Low (direct match) | Low | Low | [OK] Good |
color: blue; with a colon and semicolon ending the statement.p { color: red; color: green; }color: red; first, then color: green; which overrides red.h1 { font-size 20px; }font-size must be followed by a colon before the value.section p targets all p elements inside any section.