'Design a layout with one div on 2 columns and 2 rows at the left, and 4 divs on 2 columns and 2 rows at the right, similar to BBC website

I want to design a hero section similar to BBC website. I started working on this using CSS Grid which I thought could get the same design with minimal code.

enter image description here

I have managed to base design but I want item1 to take 50% of the container's width and rest of the items to take 25% of space each so that it looks like the image above. I can span rows but I am not sure how I can span columns correctly, I tried this :

.item1 {
   grid-column-end: span 2;
}

But it broke the design and same did happen with:

.item1 {
   grid-column: auto / span 2;
}

My code:

.grid-container {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-gap: 10px;
  background-color: #2196F3;
  padding: 0px;
}

.grid-container > div {
  background-color: rgba(255, 255, 255, 0.8);
  text-align: center;
  padding: 0px 0;
  font-size: 30px;
}

.item1 {
  grid-row-end: span 2;
}
.grid-container div img {width:100%; max-width:600px;}
<div class="grid-container">
  <div class="item1">
    <img src="https://dummyimage.com/600x400/f09c00/fafafa&text=1"/>
  </div>
  <div class="item2">
    <img src="https://dummyimage.com/600x400/0010f0/fafafa&text=2"/>
  </div>
  <div class="item3">
    <img src="https://dummyimage.com/600x400/5310f0/fafafa&text=3"/>
  </div>  
  <div class="item4">
    <img src="https://dummyimage.com/600x400/0010f0/fafafa&text=4"/>
  </div>
  <div class="item5">
    <img src="https://dummyimage.com/600x400/0010f0/fafafa&text=5"/>
  </div>

</div>


Solution 1:[1]

I will try to give You a snippet that should help You with this problem.

 // Somewhere in the code:
 std::vector<std::vector<int>> matriu;
 std::vector<std::vector<int>> usat;
 std::vector<std::vector<int>> edifici;
//

void reserva(){
    matriu = {};
    matriu.reserve(midax);
    for (int i = 0; i < midax; i++)
        matriu.push_back(std::vector<int>(miday + 1, 0));
        
    usat = {};
    usat.reserve(midax);
    for (int i = 0; i < midax; i++)
        usat.push_back(std::vector<int>(miday + 1, 0));
    
    edifici = {};
    edifici.reserve(midax);
    for (int i = 0; i < midax; i++)
        edifici.push_back(std::vector<int>(miday + 1, 0));
}

A few advices: As I wrote in the comment - try avoid using new as much as possible. It's very bug-prone. Use structures or smart pointers to avoid memory leak.

If You need to use new[], ensure that there is a corresponding delete[].

Try to code in english, it will be easier to share Your code with other people.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Maciej Czarnecki