Performance: Opacity modifiers on colors
This affects the browser's paint and composite stages by changing how colors blend and how many layers the browser must render.
Jump into concepts and practice - no test required
bg-[rgba(59,130,246,0.5)]
bg-blue-500 opacity-50
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| bg-blue-500 opacity-50 | No extra DOM nodes | 0 | Multiple paint and composite layers | [!] OK |
| bg-[rgba(59,130,246,0.5)] | No extra DOM nodes | 0 | Single paint and composite layer | [OK] Good |
bg-blue-500/50 do to the background color?bg-red-500/25 uses correct slash syntax and valid color code.text-green-700/75 is applied?bg-yellow-400/110 to set background opacity. What is wrong with this?bg-blue-600 for fully opaque blue background (default opacity 100%).hover:bg-blue-600/40 to apply 40% opacity on hover.