Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

443
Views
Filling up a window screen dynamically (horizontally and vertically)

I was trying to create a grid for my website that would fill up the entire document (with no overflow/scroll). How would I make it so that elements could be added if the screen is resized? I have tried using a grid (which helps with the vertical filling), but I haven't figured out how to fill it horizontally. So that the DOM is always full with elements?

Here are Images of what I mean Original Image

Image with window size increased

What I have so far:

<div class="photo-grid" style="display: grid;">
  <div class="card card-tall card-wide">1</div>
  <div class="card card-tall">2</div>
  <div class="card">3</div>
  <div class="card">4</div>
  <div class="card">5</div>
  <div class="card">6</div>
  <div class="card card-wide">7</div>
  <div class="card">8</div>
  <div class="card">9</div>
  <div class="card">10</div>
  <div class="card">11</div>
  <div class="card">12</div>
</div>
@import url('https://fonts.googleapis.com/css?family=Noto+Sans&display=swap');

.photo-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: 240px;
}

/* Medium screens */
@media screen and (min-width: 600px) {
  .card-tall {
    grid-row: span 2 / auto;
  }

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

.card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #353535;
    font-size: 3rem;
    color: #fff;
    box-shadow: rgba(3, 8, 20, 0.1) 0px 0.15rem 0.5rem, rgba(2, 8, 20, 0.1) 0px 0.075rem 0.175rem;
    height: 100%;
    width: 100%;
    border-radius: 4px;
    transition: all 500ms;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

How would I go about trying to solve this problem?

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!