Performance: Container and wrapper patterns
MEDIUM IMPACT
This concept affects page load speed and rendering by controlling layout structure and CSS complexity.
%container {
max-width: 75rem;
margin-inline: auto;
padding-inline: 1rem;
box-sizing: border-box;
}
.content {
width: 100%;
background: white;
}
%container {
width: 1200px;
margin: 0 auto;
}
%wrapper {
width: 100%;
padding: 20px;
box-sizing: content-box;
}
.content {
@extend %wrapper;
background: white;
}
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Fixed width container with content-box padding | Low | Multiple on resize | Medium | [X] Bad |
| Responsive max-width container with border-box | Low | Single on resize | Low | [OK] Good |