Performance: How Tailwind differs from Bootstrap
MEDIUM IMPACT
This affects page load speed and rendering performance by changing how CSS is loaded and applied.
<!-- Tailwind CSS with PurgeCSS to remove unused styles --> <link href="tailwind.min.css" rel="stylesheet"> <div class="container mx-auto p-4"> <button class="bg-blue-600 text-white px-4 py-2 rounded">Click me</button> </div>
<!-- Bootstrap CSS loaded fully --> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <div class="container"> <button class="btn btn-primary">Click me</button> </div>
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Bootstrap full CSS | Normal DOM | 1 reflow after CSS load | High paint cost due to large CSS | [X] Bad |
| Tailwind with PurgeCSS | Normal DOM | 1 reflow after CSS load | Low paint cost due to small CSS | [OK] Good |