Performance: Border color and style
This affects the paint and composite stages of page rendering, impacting how quickly borders appear and update visually.
Jump into concepts and practice - no test required
<div class="border border-gray-500 border-dashed"></div><div class="border" style="border-color: rgba(0,0,0,0.5); border-style: dashed;"></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline rgba border color with dashed style | Minimal | 0 | High (complex paint) | [X] Bad |
| Tailwind border-gray-500 and border-dashed classes | Minimal | 0 | Low (optimized paint) | [OK] Good |
red-500.border-{color}-{shade}, so border-red-500 is correct.border-{color}-{shade} format [OK]border-color-shade format for colors [OK]border-color-red which is invalidborder-red without shadeborder-solid, border-dashed, border-dotted for border styles.border-dashed is the correct class to apply dashed border style.border- + style [OK]border- + style name [OK]border-dash which is not validborder-style-dashed<div class="border-4 border-blue-700 border-dotted">Content</div>
border-4 means border width is 4 pixels, which is thick.border-blue-700 sets a dark blue color, and border-dotted sets dotted style.<div class="border-2 border-green border-solid">Box</div>
border-green is incomplete; Tailwind requires a shade like border-green-500.border-2 and border-solid are valid classes.-500 [OK]border-red-600 and border-solid for small screens (default).md:border-blue-600 and md:border-dashed to change color and style on medium+ screens.border border-red-600 border-solid md:border-blue-600 md:border-dashed -> Option Amd: prefix [OK]md: prefix to change styles on medium screens [OK]border class