Using Grid Layout

In this example each paragraph is now contained by a div. Each div that is a direct child of main is declared as an inline-size container, and a container query is then used to restyle the content of the paragraphs.

Paras that are over 20 ems wide have a red background with white text, so as the page is expanded, different grid elements will light up red - the larger ones first, then all of them if the screen is wide enough.

...and finally...!

Grids are nice.

Hello mum!

Grids are dynamic.

Grids are surprising.

ooooooooh this is nice.

Grids are etc.