Grid area in CSS grid

Grid area in CSS grid
0

#1

hey

any idea why cell number 4 disappeared when i try to place it in the footer?

also, why cell number 5 takes the entire width?

<style>
  .item1{background:LightSkyBlue;}
  .item2{background:LightSalmon;}
  .item3{background:PaleTurquoise;}
  .item4{background:LightPink; grid-area: footer;}
  
  .item5 {
    background: PaleGreen;
    /* add your code below this line */
    
    grid-area: footer;
    
  }
  
  .container {
    font-size: 40px;
    min-height: 300px;
    width: 100%;
    background: LightGray;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr 1fr;
    grid-gap: 10px;
    grid-template-areas: 
      "header header header"
      "advert content content"
      "footer footer footer";
  }
</style>
  
<div class="container">
  <div class="item1">1</div>
  <div class="item2">2</div>
  <div class="item3">3</div>
  <div class="item4">4</div>
  <div class="item5">5</div>
</div>


#2

Hey Tomer,
Can you post the challenge link?


#3

hey @aditya_p

try to place the grid-area on item 4

https://learn.freecodecamp.org/responsive-web-design/css-grid/place-items-in-grid-areas-using-the-grid-area-property/


#4

You need to remove grid area from item-4 and you should be good to go.
Hope it helps.


#5

hey @aditya_p

that was my purpose , to place item4 in the footer


#6

The item4 is under the item5 because both are in the footer right now


#7

hey @Michael55555

why they don’t share the space? each take the entire row space instead of just on cell in the footer


#8

You cannot give same grid:area property to two elements.


#9

@tomer-n, aditya_p is right


#10

thanks man, that’s the thing