Full-Bleed Layout Using CSS Grid
joshwcomeau.com
Full-Bleed Layout Using CSS Grid
1–10 of 277 posts
Re: Full-Bleed Layout Using CSS Grid
#2Re: Full-Bleed Layout Using CSS Grid
#3This is actually a really neat technique. I've done full-bleed layouts before grid was around, but it required messing around with negative margins, which is fragile and hard to get right.
margin: 0 calc(50vw - 50% - 1rem);
or something, which feels really hacky.Re: Full-Bleed Layout Using CSS Grid
#4As a matter of fact, that would require even less attributes to work compared to the method presented in the article.
Re: Full-Bleed Layout Using CSS Grid
#5Re: Full-Bleed Layout Using CSS Grid
#6Re: Full-Bleed Layout Using CSS Grid
#7Great article. While CSS grid is very powerful, maybe I'm not seeing the full picture in the examples: aren't the examples possible with just p { margin: 0 auto; max-width: 65ch } ? What does grid bring here?
#content p, h1, h2, h3, nav { .. }
Kind of a pain to manually specify each element that you want to constrain, when it's most of them. This approach allows you to instead target the items that you don't want to constrain.Additionally, as a more specific issue, the static-site generator that I use renders markdown such that images are inside a paragraph, so your approach wouldn't work at all for me.
Edit: As an aside, that's a super fun site! Lots of neat little UI easter eggs.
Re: Full-Bleed Layout Using CSS Grid
#8Wait until Web developers find about setting a width and horizontal margins: auto on a block container again. As a matter of fact, that would require even less attributes to work compared to the method presented in the article.
Re: Full-Bleed Layout Using CSS Grid
#9FF 80.0.1 MacOS 10.14 (yeah it's old)
Re: Full-Bleed Layout Using CSS Grid
#10Yes it does. You can use
.wrapper h1, .wrapper p {}
or soon .wrapper :is(h1,p) {}
Alternatively, you can also use .wrapper > :not(.full-bleed) {}
And in SCSS (or similar) you can write .wrapper { h1,p {} }
(edit: Earlier versions of this comment mentioned :has instead of :is)