Performance: Text decoration and underline
This affects the paint and composite stages of page rendering, impacting how quickly text styles appear and update.
Jump into concepts and practice - no test required
<a class="underline decoration-blue-500 hover:decoration-blue-700">Link</a><a class="border-b-2 border-blue-500 hover:border-blue-700">Link</a>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Using border for underline | Minimal | Multiple on hover | High due to repaint and layout shift | [X] Bad |
| Using text-decoration underline | Minimal | None on hover | Low paint cost | [OK] Good |
underline class adds an underline to text, while line-through crosses out text, no-underline removes underline, and text-underline is not a valid Tailwind class.underline is the correct class.no-underline removes underline decoration from text.underline adds underline, line-through crosses out text, and text-no-underline is not a valid Tailwind class.<p class="underline line-through text-red-500">Hello</p>
underline and line-through add underline and line-through decorations respectively. text-red-500 colors the text red.<span class="underline text-underline-red">Sample</span>
underline is valid and adds underline. text-underline-red is not a valid Tailwind class for underline color.decoration-red-500 or similar for underline color, not text-underline-red.underline adds underline, and decoration-green-600 colors the underline green.line-through or any similar class. There is no no-line-through class in Tailwind.