Uncurated
Published in

Uncurated

CSS Grid (Part 7) — Repeat function

Save the effort of repeating yourself

Live dev notes taken throughout the CSS Grid course by Wesbos — cssgrid.io

So far, we’ve been hard coding the width and height of tracks to match the number of tracks, but there is a faster way to do this. Take this previous example:

grid-template-columns: 1fr 1fr 1fr 1fr;

We can rewrite it like this:

grid-template-columns: repeat(4, 1fr);

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store