Performance: Text decoration
Text decoration affects the paint and composite stages of rendering, impacting how quickly styled text appears and updates on screen.
Jump into concepts and practice - no test required
p { text-decoration: underline solid black; }p { text-decoration: underline wavy red; }| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| text-decoration: underline solid | none | none | low paint cost | [OK] Good |
| text-decoration: underline wavy | none | none | higher paint cost | [X] Bad |
text-decoration controls lines like underline, overline, and line-through on text.text-decoration: underline; adds an underline to the text.text-decoration include underline, overline, and line-through.line-through. Other options like strike or crossed are invalid.p { text-decoration: underline overline; }text-decoration property can accept multiple values separated by spaces to combine effects.underline overline applies both lines above and below the text simultaneously.h1 { text-decoration: underlined; }underline, overline, line-through, but not underlined.text-decoration is correct and semicolon is present. The selector h1 is valid.text-decoration: none; on the link to remove underline by default.a:hover, add text-decoration: underline; and set text-decoration-color: red; to color the underline red.