Performance: Custom breakpoints
MEDIUM IMPACT
Custom breakpoints affect how CSS media queries load and apply styles, impacting rendering speed and layout shifts on different screen sizes.
module.exports = {
theme: {
extend: {},
screens: {
'sm': '480px',
'md': '768px',
'lg': '1024px',
'xl': '1280px',
'2xl': '1536px'
}
}
}module.exports = {
theme: {
extend: {},
screens: {
'sm': '480px',
'md': '768px',
'lg': '1024px',
'xl': '1280px',
'2xl': '1536px',
'custom': '600px',
'custom2': '900px',
'custom3': '1100px'
}
}
}| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Many close custom breakpoints | No change | Multiple reflows on resize | Higher paint cost due to frequent layout shifts | [X] Bad |
| Few well-spaced breakpoints | No change | Minimal reflows on resize | Lower paint cost with stable layout | [OK] Good |