CSS Grid row/column gap on specific elements?

I have a work around to get your desired result. I just moved all the three rows in a separate grid section. I am not sure if it helps or not but here it is:

body {
  margin: 40px;
}

.wrapper1 {
  display: grid;
  grid-gap: 10px;
  grid-template-columns: [col] 100px [col] 100px [col] 100px;
  grid-template-rows: [row] auto [row] auto [row] ;
  background-color: #fff;
  color: #444;
  margin-bottom: 10px;
}
.wrapper2 {
  display: grid;
  grid-template-columns: [col] 100px [col] 100px [col] 100px;
  grid-template-rows: [row] auto [row] auto [row] ;
  background-color: #fff;
  color: #444;
  margin-bottom: 10px;
}

.wrapper3 {
  display: grid;
  grid-template-columns: [col] 100px [col] 100px [col] 100px;
  grid-template-rows: [row] auto [row] auto [row] ;
  background-color: #fff;
  color: #444;
  margin-bottom: 10px;
}

.box {
  background-color:#444;
  color:#fff;
  padding:20px;
  font-size:150%;
}
.a {
  grid-column: col 1 / span 2;
  grid-row: row 1 / 3;
}

.b {
  grid-column: col 3 / span 1;
  grid-row: row ;
}

.c {
  grid-column: col 3 / span 1;
  grid-row: row 2 ;
}

.d {
  grid-column: col 1 / span 1;
  grid-row: row 3;
  width: 80%;
}

.e {
  grid-column: col 2 / span 1;
  grid-row: row 3;
  width: 80%;
}

.f {
  grid-column: col 3 / span 1;
  grid-row: row 3;
  width: 80%;
}

.g {
  grid-column: col 1 / span 1;
  grid-row: row 4;
  width: 80%;
}

.h {
  grid-column: col 2 / span 1;
  grid-row: row 4;
  width: 80%;
}

.i {
  grid-column: col 3 / span 1;
  grid-row: row 4;
  width: 80%;
}
<div class="wrapper1">
    <div class="box a">A</div>
    <div class="box b">B</div>
    <div class="box c">C</div>
</div>
<div class="wrapper2">
    <div class="box d">D</div>
    <div class="box e">E</div>
    <div class="box f">F</div>
</div>
<div class="wrapper3">
    <div class="box g">G</div>
    <div class="box h">H</div>
    <div class="box i">I</div>
</div>

It's impossible to change the gap on specific elements.

However, you can reference specific grid item with grid-item:nth-child(n) and set negative margins to it.

For example, with a class of picture-1 it may look like this in the CSS file:

.picture-1:nth-child(3) {
  margin-bottom: -50px;
}

Tags:

Css

Grid

Css Grid