I have this code that is supposed to look like this.
BUT, this is broken on services like Codepen, JSFiddle, Liveweave etc. EVEN on Stackoverflow!!! They are all broken here.
However, it is working fine on repl.it or when I run it locally.
I see only Liveweave raising an errorlike expected rbrace at line
..
but I did not run into this trouble when running other examples. Why would this be the case?
I linked the code to above services but here is the code
(S)CSS Masterclassbody {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}
.grid {
color: white;
display: grid;
gap: 5px;
grid-auto-rows: 100px;
margin-bottom: 30px;
}
.item:nth-child(odd) {
background-color: #2ecc71;
}
.item:nth-child(even) {
background-color: #3498db;
}
.grid:first-child {
grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
}
.grid:last-child {
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css" />
<title>(S)CSS Masterclass</title>
</head>
<body>
auto-fill
<div class="grid">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
auto-fit
<div class="grid">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
</body>
</html>