Q:

How to center a grid

This may be a really stupid question but I'm having a hard time to find an answer on this: how do you center a grid itself horizontally? I can only seem to find how to center the items within the grid. Is there a "best practice" of this? Thanks

A:

flexbox is the easiest way to do it. You have to give the parent element:
display:flex;
justify-content: center;

In my case its the body tag which wraps my grid

body {
  margin: 40px;
  display: flex;
  justify-content: center;
}

.wrapper {
  display: grid;
  grid-template-columns: 100px 100px 100px;
  grid-gap: 10px;
  background-color: #fff;
  color: #444;
}

.box {
  background-color: #444;
  color: #fff;
  border-radius: 5px;
  padding: 20px;
  font-size: 150%;
}
<div class="wrapper">
  <div class="box a">A</div>
  <div class="box b">B</div>
  <div class="box c">C</div>
  <div class="box d">D</div>
  <div class="box e">E</div>
  <div class="box f">F</div>
</div>

