<div class="grid">
  <svg class="lines lines-desktop">
    <line x1="0%" y1="0%" x2="0%" y2="100%"/>
    <line x1="100%" y1="0%" x2="100%" y2="100%"/>
    <line x1="0%" y1="0%" x2="100%" y2="0%"/>
    <line x1="0%" y1="100%" x2="100%" y2="100%"/>
    <line x1="0%" y1="0%" x2="100%" y2="100%"/>
    <line x1="100%" y1="0%" x2="0%" y2="100%"/>
    <line x1="0%" y1="33.33%" x2="100%" y2="66.66%"/>
    <line x1="0%" y1="66.66%" x2="100%" y2="33.33%"/>
  </svg>
  
  <svg class="lines lines-mobile">
    <line x1="0%" y1="0%" x2="0%" y2="100%"/>
    <line x1="0%" y1="0%" x2="100%" y2="0%"/>
    <line x1="0%" y1="11.11%" x2="100%" y2="11.11%"/>
    <line x1="0%" y1="22.22%" x2="100%" y2="22.22%"/>
    <line x1="0%" y1="33.33%" x2="100%" y2="33.33%"/>
    <line x1="0%" y1="44.44%" x2="100%" y2="44.44%"/>
    <line x1="0%" y1="55.55%" x2="100%" y2="55.55%"/>
    <line x1="0%" y1="66.66%" x2="100%" y2="66.66%"/>
    <line x1="0%" y1="77.77%" x2="100%" y2="77.77%"/>
    <line x1="0%" y1="88.88%" x2="100%" y2="88.88%"/>
    <line x1="0%" y1="100%" x2="100%" y2="100%"/>
  </svg>
  <div class="item">1</div>
  <div class="item">2</div>
  <div class="item">3</div>
  <div class="item">4</div>
  <div class="item item--empty"></div>
  <div class="item">5</div>
  <div class="item">6</div>
  <div class="item item--empty"></div>
  <div class="item">7</div>
  <div class="item">8</div>
  <div class="item">9</div>
  <div class="item">10</div>
</div>
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 20px;
  position: relative;
  z-index: 0;
}

.item:not(.item--empty) {
  background-color: #607d8b;
  color: #fff;
  text-align: center;
  padding: 20px;
  border-radius: 15px;
}

.lines {
  transform: translate(0.5px, 0.5px);
  position: absolute;
  overflow: visible;
  z-index: -1;
}

.lines-desktop {
  top: calc((100% - 3 * 20px) / 4 / 2);
  left: calc((100% - 2 * 20px) / 3 / 2);
  width: calc(100% - (100% - 2 * 20px) / 3);
  height: calc(100% - (100% - 3 * 20px) / 4);
}

.lines-mobile {
  display: none;
}

.lines-mobile {
  top: calc((100% - 9 * 20px) / 10 / 2);
  left: 0;
  width: 50%;
  height: calc(100% - (100% - 9 * 20px) / 10);
}

line {
  stroke-width: 1px;
  stroke: #4caf50;
}

@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    padding: 0 20px;
  }

  .item--empty {
    display: none;
  }

  .lines-desktop {
    display: none;
  }

  .lines-mobile {
    display: block;
  }
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.