0

I already read previous questions on number of columns. That doesn't seem to be the issue in mine.

Here's my code:

    #agenda div.item {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr 1fr 1fr 1fr;
      grid-template-rows: 2fr 1fr 1fr 1fr;
      grid-template-areas:
        "time h3 h3 h3 h3 aside"
        "span h3 h3 h3 h3 aside"
        "blank h3 h3 h3 h3 aside"
        "blank p p p blank blank";
    }

    div.item {
      margin: 1em;
      border: 1px solid grey;
      border-radius: 5px;
    }

    #agenda time,
    #agenda span,
    #agenda h3,
    #agenda p,
    #agenda aside {
      box-sizing: border-box;
      height: 100%;
      padding: .5em;
    }

    #agenda time {
      grid-area: "time";
      background: red;
    }

    #agenda span {
      grid-area: "span";
      background: green;
    }

    #agenda h3 {
      grid-area: "h3";
      margin: 0;
      background: blue;
    }

    #agenda p {
      grid-area: "p";
      margin: 0;
      background: orange;
    }

    #agenda aside {
      grid-area: "aside";
      background: yellow;
    }
  <section id="agenda">

    <div class="item">
      <time>10:00 AM ET</time>
      <h3>The Genius I Was Yesterday</h3>
      <aside>Output: Stuff</aside>
      <span>30 minutes</span>
      <p>Others: Observing</p>
    </div>

    <div class="item">
      <time>10:30 AM ET</time>
      <h3>BREAK</h3>
      <aside></aside>
      <span>15 minutes</span>
      <p>Others: Quick Huddle</p>
    </div>

  </section>

I also noticed the order matters. If I rearrange the HTML it doesn't reflow according to the grid-template-layout.

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Costa Michailidis
  • 7,691
  • 15
  • 72
  • 124
  • 1
    (1) grid template should be rectangular AND contiguous (2) there is no quotes when using grid-area – Temani Afif Jun 24 '20 at 00:38
  • Taking away 'blank' and quotes from grid-area rules didn't work. Did I misunderstand? Can you copy my code and change it? – Costa Michailidis Jun 24 '20 at 02:47
  • Baaahhh! The blank, which I was intentionally leaving blank, is not rectangular. Thank you! : ) – Costa Michailidis Jun 24 '20 at 18:49
  • 1
    Replace the `blank` with `.`. Dots will work. – Michael Benjamin Jun 27 '20 at 12:05
  • @TemaniAfif MDN says quote areas, the quotes are required: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout/Layout_using_Named_Grid_Lines#implicit_grid_lines_from_named_areas – run_the_race Aug 17 '21 at 09:18
  • @run_the_race not sure where you are reading this but if you check closely the link you sent you will see that MDN is not using quotes at all – Temani Afif Aug 17 '21 at 09:24
  • @TemaniAfif, we must be mis understanding each other then, here: The link quotes each line, search for this text: `grid-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" "ft ft ft ft ft ft ft ft ft";` – run_the_race Aug 17 '21 at 09:26
  • @run_the_race in my comment I said : *there is no quotes when using grid-area* (also check the duplicate to understand what I meant) – Temani Afif Aug 17 '21 at 09:28
  • @TemaniAfif okay my mistake, I see you are talking about when inserting the item with `grid-area`, not `grid-template-areas`. Thanks for that. – run_the_race Aug 17 '21 at 09:32

0 Answers0