我对css和idk还是个新手,如何使用网格和Flexbox制作这种布局(6个框) (https://i.stack.imgur.com/zycwb.png)

我能想到的唯一方法是创造出这样的东西 (https://i.stack.imgur.com/P2wxm.png)

<template>
    <div class="container">
      <div class="row">
        <div class="col text-center">
          <h3>Best Of The Best</h3>
          <p>Sebuah lembaga pendidikan yang didedikasikan untuk memaksimalkan potensi anak bangsa.</p>
        </div>
      </div>
      <div class="hero-box-container">
        <div class="hero-box hero-box-1">1</div>
        <div class="hero-box hero-box-2">2</div>
        <div class="hero-box hero-box-3">3</div>
        <div class="hero-box hero-box-4">4</div>
        <div class="hero-box hero-box-5">5</div>
        <div class="hero-box hero-box-6">6</div>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: 'Hero',
  };
  </script>
  
  <style scoped>
.hero-box-container {
  display: grid;
  grid-template-columns: 33% 33% 33%;
  grid-template-rows: 200px 200px;
}

.hero-box-1 {
  background-color: #70e9c9;
}

.hero-box-2 {
  background-color: #63dbbb;
}

.hero-box-3 {
  background-color: #51c9a9;

}

.hero-box-4 {
  background-color: #3dafa0;
}

.hero-box-5 {
  background-color: #309d96;
}

.hero-box-6 {
  background-color: #1e897a;
}
</style>

任何形式的帮助都将不胜感激

推荐答案

考虑定义一个具有更多列和行轨道的网格.根据需要让某些项目填充多个行或列轨道,以产生所需的外观:

.hero-box-container {
  display: grid;
  grid-template-columns: 40% 23% 4% 23%;
  grid-template-rows: 300px 50px 200px;
}

.hero-box-1 {
  background-color: #70e9c9;
  grid-row: 1 / 3;
}

.hero-box-2 {
  background-color: #63dbbb;
  grid-column: 2 / 4;
}

.hero-box-3 {
  background-color: #51c9a9;
}

.hero-box-4 {
  background-color: #3dafa0;
  grid-row: 3;
}

.hero-box-5 {
  background-color: #309d96;
  grid-row: 2 / 4;
}

.hero-box-6 {
  background-color: #1e897a;
  grid-row: 2 / 5;
  grid-column: 3 / 5;
}
<div class="container">
  <div class="row">
    <div class="col text-center">
      <h3>Best Of The Best</h3>
      <p>Sebuah lembaga pendidikan yang didedikasikan untuk memaksimalkan potensi anak bangsa.</p>
    </div>
  </div>
  <div class="hero-box-container">
    <div class="hero-box hero-box-1">1</div>
    <div class="hero-box hero-box-2">2</div>
    <div class="hero-box hero-box-3">3</div>
    <div class="hero-box hero-box-4">4</div>
    <div class="hero-box hero-box-5">5</div>
    <div class="hero-box hero-box-6">6</div>
  </div>
</div>

Html相关问答推荐

悬停时跳转的内容

如何在div中淡入和淡出渐变背景?

react :事件和转发器在特定代码段中不起作用

悬停效果在新西兰表上不起作用

为什么在移动视图中,这个水平可滚动的表格会在表格的右侧显示额外的空间?

我无法使用背景图像css,因为我在VS代码中将照片放在不同的文件夹中

Div中的图像问题-(TailWind CSS中的网格)

OnChange函数未在下拉列表中使用一个选项触发

不呈现孙子元素,使用R htmlTools::Taglist为分页的pdf生成HTML

如何制作';在第';页中搜索;是否发现多个元素中的单词?

如何在Go模板中传入途中创建的 map

如何使用多边形制作如图所示的背景

是否有语义 HTML 可以澄清含义?

网页爬虫:使用时光机器进行数据采集

在Firefox中使用keySplines时,SVG: <animateMotion>不起作用

Cargo 在网格中的排列

打开 Bootstrap 模式时无法获得模糊的背景

网站页脚中的 Quarto 安装版本

是否有一种静态方式可以根据暗模式 Select 一张或另一张图像?

根据正则表达式 attr 从 read_html 过滤表格