Performance: Border radius (rounded corners)
Border radius affects the paint and composite stages of rendering, influencing how quickly the browser can draw and display rounded corners.
Jump into concepts and practice - no test required
<div class="rounded-md"></div><div class="rounded-full" style="border-radius: 9999px;"></div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Large border-radius on many elements | Low | None | High (complex paint) | [X] Bad |
| Moderate border-radius on few elements | Low | None | Low (simple paint) | [OK] Good |
rounded do to an element?rounded classrounded class in Tailwind CSS is used to add rounded corners to elements.rounded affectsrounded class [OK]rounded class [OK]rounded-sm for small, rounded-md for medium, rounded-lg for large, and rounded-xl for extra large radius.rounded-md.rounded-md [OK]rounded-md class [OK]rounded-lg or rounded-xl for mediumrounded-sm as medium<div class="w-32 h-32 bg-blue-500 rounded-tl-lg rounded-br-lg"></div>
rounded-tl-lg and rounded-br-lg apply large rounding to the top-left and bottom-right corners respectively.rounded-tl-lg and rounded-br-lg [OK]<button class="rounded-top-md bg-green-400 p-4">Click</button>
rounded-t for top corners, not rounded-top.p-4 and bg-green-400 are valid Tailwind classes, and buttons can have rounded corners.rounded-top-md is invalid in Tailwind -> Option Arounded-t-md [OK]rounded-t-md for top corners, not rounded-top-md [OK]rounded-b-xl rounds both bottom-left and bottom-right corners to extra large size.rounded-bl-xl and rounded-br-xl individually round corners but rounded-b-xl is simpler and correct. rounded-xl rounds all corners, and rounded-bottom-xl is invalid.rounded-b-xl [OK]rounded-b-xl for both bottom corners [OK]rounded-bottom-xlrounded-xl which rounds all corners