Grid Experiments

In this example below you will see how to do a Grid Experiments with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by taverasmisael, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright taverasmisael ©
  • HTML
  • CSS
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Grid Experiments</title>
  
  
  
      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div class="parent">
  <div class="child">1</div>
  <div class="child">2</div>
  <div class="child">3</div>
  <div class="child">4</div>
  <div class="child">5</div>
  <div class="child">6</div>
  <div class="child">7</div>
  <div class="child">8</div>
  <div class="child">9</div>
  <div class="child">10</div>
</div>

<div class="board">
  <div class="square">x</div>
  <div class="square">x</div>
  <div class="square">x</div>
  <div class="square"></div>
  <div class="square"></div>
  <div class="square"></div>
  <div class="square"></div>
  <div class="square"></div>
  <div class="square"></div>
</div>
  
  

</body>

</html>

/*Downloaded from https://www.codeseek.co/taverasmisael/grid-experiments-bYyLWr */
body {
  display: flex;
  align-items: flex-start;
  font-family: sans-serif;
  font-size: 3rem;
}
.parent {
  display: grid;
  grid-template-columns: repeat(3, 2em);
  grid-auto-rows: 2em;
  grid-gap: 1rem;
  margin-bottom: 1rem;
  margin-right: 5rem;
}
.child {
  background: #fa2332;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 2em);
  grid-template-rows: repeat(3, 2em);
  grid-gap: 0.5rem;
  background: grey;
  width: 6em;
}
.square {
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

Comments