DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Equally divided code editor / viewer, optimized for both desktop and mobile

This is quite easy really, if you know how grid works.

html, body {
  margin: 0;
  padding: 0;
}

.has-2-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  height: 100vh;
  width: 100vw;
}

@media only screen and (max-width: 1000px) {
  .has-2-columns {
    grid-template-rows: 1fr 1fr;
    grid-template-columns: none;
  }
}
Enter fullscreen mode Exit fullscreen mode

See https://hyperpug.netlify.app/

Top comments (0)