by swyx · 4y ago · 0 comments
I made a responsive version here: https://github.com/sw-yx/spark-joy/blob/master/README.md#lay...
.swyxcontent {
--gap: clamp(1rem, 6vw, 3rem);
--full: minmax(var(--gap), 1fr);
--content: min(65ch, 100% - var(--gap) * 2);
--popout: minmax(0, 2rem);
--feature: minmax(0, 5rem);
display: grid;
grid-template-columns:
[full-start]
[feature-start]
[popout-start]
[content-start] var(--content) [content-end]
[feature-end]
[popout-end]
[feature-end]
[full-end]
}
@media (min-width: 640px) {
.swyxcontent {
grid-template-columns:
[full-start] var(--full)
[feature-start] var(--feature)
[popout-start] var(--popout)
[content-start] var(--content) [content-end]
var(--popout) [popout-end]
var(--feature) [feature-end]
var(--full) [full-end];
}
}what do you mean breaking column centring? it looks fine on my test https://deploy-preview-127--swyxkit.netlify.app/layout-break...
The problem is you’ve put this inside a container that already has a side gap, which is not how it was supposed to be used. Inspect the grid tracks on the original article at various viewport sizes. Full bleed means that the item goes right to the edge of the viewport.