未应用网格间隙 - CSS 网格

Grid gap not being applied - CSS Grid

提问人:Ope Afolabi 提问时间:11/17/2023 最后编辑:David ThomasOpe Afolabi 更新时间:11/18/2023 访问量:34

问:

我正在使用 html 和 css 为一家小型企业构建一个网站,稍后我将将其转换为 WordPress。我遇到的问题是,服务卡上没有应用间隙。我的猜测是这与应用于父级 (.services) 的 width/max-width 有关。如何解决此问题?Codepen 链接: https://codepen.io/gbopola/pen/zYepdWo

/* services section */

.services {
  width: 90%;
  max-width: 1300px;
  margin: 15rem auto 5rem auto;
}

.services-card-wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  background: #f8f9fa;
}
<!-- Services Section -->
<section class="services">
  <div class="services-header">
    <h1>Our Services</h1>
    <p class="services-subtext">
      Our diverse range of services are designed to meet the unique needs of businesses and government agencies in Nigeria. Our expert consultants bring a wealth of experience to provide strategic solutions.
    </p>
  </div>
  <div class="services-card-wrapper">
    <div class="service-card">
      <img src="./images/wifi.svg" />
      <h2>Telecommunication</h2>
      <p>
        Stay connected and efficient with our telecommunication solutions. From infrastructure development to network optimization, we enhance your communication capabilities.
      </p>
    </div>
    <div class="service-card">
      <img src="./images/book-open.svg" />
      <h2>Specialist Training</h2>
      <p>
        Invest in your team's skills and knowledge. Our specialized training programs cover a wide range of topics, ensuring your workforce is equipped for the challenges of today and tomorrow.
      </p>
    </div>
    <div class="service-card">
      <img src="./images/users.svg" />
      <h2>Specialist Recruitment</h2>
      <p>
        Build a high-performing team with our specialist recruitment services. We identify and place top talent in your organization, matching skills and culture for long-term success.
      </p>
    </div>
  </div>
</section>

HTML 弹性框 CSS-网格

评论

1赞 Paulie_D 11/17/2023
差距在哪些方面不起作用?似乎与您的代码有关 - codepen.io/Paulie-D/pen/PoVEjVE
0赞 Ope Afolabi 11/17/2023
我已经发布了完整的代码 codepen.io/gbopola/pen/zYepdWo
0赞 Paulie_D 11/18/2023
将您的代码发布在这里的堆栈代码段中,而不是远程链接中,但它仍然没有显示问题。显然在那里。gap

答: 暂无答案