Skip to content
Grid기술 정리

Reviewing CSS Grid by drawing a Go board

1 min readTech notesMoved from my Tistory blogRead the Korean original

Go board
Figure 1. Go board

This morning's task at work was centering a set of split buttons, and to do that I had no choice but to use grid.

I hadn't used grid in a while, so it wasn't easy, and I drew a Go board to review it once more.

The code for the Go board is below.

jsx
import { styled } from "styled-components";

function App() {
  return (
    <GridBody>
      <div>·</div>
      <div></div>
      <div></div>
      <div></div>
      <div>·</div>
      <div></div>
      <div></div>
      <div></div>
      <div>·</div>
    </GridBody>
  );
}

export default App;

const GridBody = styled.div`
  width: 50%;
  height: 70vh;
  border: 1px solid black;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);

  > div {
    border: 1px solid black;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10rem;
  }
`;
  • #CSS Grid
  • #Go board
  • #review

More in Tech notes