⊗mkPmGdAFlV 228 of 250 menu

The meaning of auto-fill in CSS grids

To set the size of equal columns of a grid container, it is very convenient to specify the value auto-fill in the repeat function, thanks to which our container will be filled with equal columns of the width we need.

Let's make a table of eight elements and give each column the same width of 200px. Let the auto-fill value calculate the required number of columns:

<div id="parent"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> <div>7</div> <div>8</div> </div> #parent { display: grid; grid-template-columns: repeat(auto-fill, 200px); border: 2px solid #696989; padding: 10px; } #parent > div { padding: 10px; border: 1px solid #696989; }

:

Set the column width to 200px. Change the parent width and see how the number of columns changes.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline