CSS GRID 避免在网格中使用 ::before 和 ::after

Elr*_*des 1 css css-grid

当我使用 CSS Grid 时,网格如何将之前和之后作为网格元素。有什么办法可以解决这个问题吗?

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

.wrapper::before {
  content: "::before element";
}

.wrapper::after {
  content: "::after element";
}

.box {
  background-color: #444;
  color: #fff;
  border-radius: 5px;
  padding: 20px;
  font-size: 150%;
}
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)

Har*_*ngh 5

尝试这个

.wrapper::after, .wrapper::before{ display:none !important;}
Run Code Online (Sandbox Code Playgroud)