<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CSS Grid</title>
<style>
body {
font-family: sans-serif;
}
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
/* Przerwy między wierszami i kolumnami. */
column-gap: 10px;
row-gap: 10px;
/* Powyższe dwie właściwości można zapisać w poniższej,
zakomentowanej teraz formie: */
/* gap: 10px; */
width: 600px;
margin: 20px 0;
}
.grid div {
background: lightskyblue;
padding: 20px;
text-align: center;
}
.grid div:nth-child(even) {
background: goldenrod;
}
</style>
</head>
<body>
<h1>CSS Grid</h1>
<div class="grid">
<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>9</div>
</div>
</body>
</html>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.