Article Layout with Varying Content Width Using CSS Grid

An ordinary, totally normal paragraph. No strings attached, no promises attached. Just dull content. Trust me.

Another totally normal paragraph, but this time, it’s accompanied by a side note, sometimes also called boxout. This works well with CSS grid with the exception of side notes that take up more height than their related paragraph. Gotta try to avoid that.

This is the mentioned side note. It’s very good.

An ordinary, totally normal paragraph. No strings attached, no promises attached. Just dull content. Trust me.

Figure

Yellow flower in front of out-of-focus background
via Flickr , shot with an Auto Revuenon 1:1.9/50mm manual lens.

An ordinary, totally normal paragraph. No strings attached, no promises attached. Just dull content. Trust me.

Code Block

@media only screen and (min-width: 1000px) {
  article {
    max-width: 1000px;
    margin-right: auto;
    margin-left: auto;

    display: grid;
    grid-column-gap: 1.5rem;
    align-items: start;
    grid-template-columns:
      [full-start main-start] 3fr [main-end side-start] minmax(auto, 1fr) [side-end full-end];
  }
}