Cant pass through this

Tell us what’s happening:
When the viewport width is 400px or more, make the header area occupy the top row completely and the footer area occupy the bottom row completely.

Your code so far


<style>
.item1 {
  background: LightSkyBlue;
  grid-area: header;
}

.item2 {
  background: LightSalmon;
  grid-area: advert;
}

.item3 {
  background: PaleTurquoise;
  grid-area: content;
}

.item4 {
  background: lightpink;
  grid-area: footer;
}

.container {
  font-size: 1.5em;
  min-height: 300px;
  width: 100%;
  background: LightGray;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 50px auto 1fr auto;
  grid-gap: 10px;
  grid-template-areas:
    "header"
    "advert"
    "content"
    "footer";
}

@media (min-width: 300px){
  .container{
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "advert header"
      "advert content"
      "advert footer";
  }
}

@media (min-width: 400px){
  .container{
    /* change the code below this line */

    grid-template-areas:
      "advert header"
      "advert content"
      "advert footer";

  /* change the code above this line */
  }
}
</style>

<div class="container">
<div class="item1">header</div>
<div class="item2">advert</div>
<div class="item3">content</div>
<div class="item4">footer</div>
</div>

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.79 Safari/537.36.

Challenge: Use Media Queries to Create Responsive Layouts

Link to the challenge:
https://www.freecodecamp.org/learn/responsive-web-design/css-grid/use-media-queries-to-create-responsive-layouts

Think of your page as a table with 2 columns and 3 rows as follows:

1 2
3 4
5 6

As of now, cell 1 is occupied by “advert” and cell 2 is occupied by “header”. What challenge wants you to do is make header occupy both cells 1 and 2. With this hint, try solving now.

Text not mine i copied past it from

I am Not Understanding What is wrong

Is this CSS? Sorry, I haven’t reached this topic yet. Anyway, I wish I knew all that you know at this time.

1 Like

@media (min-width: 400px){
.container{
/* change the code below this line */

grid-template-areas:
  "advert header"
  "advert content"
  "advert footer";

/* change the code above this line */
}
}

Understand it like this


///////
grid-template-areas:
“top top”
“mid mid”
“bottom bottom”

//////////

if you need more hints change thing around in column

h1 should remain outside tag. consider it as your and paragraphs as your main contents of the page