Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9190185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:24:13+00:00 2026-06-17T20:24:13+00:00

I’m working on a 4 column grid of divs, that when the browser size

  • 0

I’m working on a 4 column grid of divs, that when the browser size is reduced all the divs are scaled down in size in ratio.
The problem is I want to have 2 div sizes within the grid (big and small), i.e. the big div is the width of 2 columns, while the small div is the width of one.
Here’s my code and the problem I’m having:
HTML:

<div id="thumb-wrap">

    <div id="thumb-container-2">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #ffe413;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #8ca4a5;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #f9ded6;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #f57882;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #eaebe6;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #ffe93b;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #f3f3f4;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #003738;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #939597;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #e6e7e0;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #f14e5b;">
            some text
        </div>
    </div>

    <div id="thumb-container">
        <div class="thumb-dummy"></div>
        <div class="thumb-element" style="background-color: #de4d79;">
            some text
        </div>
    </div>  
</div>

CSS:

#thumb-wrap {
    position: absolute;
    width: 95%;
    left: 3%;
    top: 40px;
    font-family:'Neuzeit S LT W01 Book', Helvetica, sans-serif;
    font-size: 14px;
    padding-bottom: 150px;
}

#thumb-wrap a {
    opacity: 1.0;
}

#thumb-wrap a:hover {
    opacity: 0.6;
    text-decoration: none;
}

#thumb-container {
    display: inline-block;
    position: relative;
    width: 24%;
    padding-left: 0.5%;
}

#thumb-container-2 {
    display: inline-block;
    position: relative;
    width: 49%;
    padding-left: 0.5%;
}

.thumb-dummy {
    padding-top: 66%;
}

.thumb-element {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    border: 2px solid white;
    padding-top: 19px;
    background: no-repeat 50% 50%;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

Here’s a working demo jsfiddle here too: http://jsfiddle.net/jzgSP/

As you can see, the problem I’m having is that when a bigger div size is introduced, the smaller divs are aligning to the bottom, instead of all fitting nicely into the grid and sitting flush with the top of the page.
I have used the masonry / isotope plugins before, but I’m not sure they’re relevant for something like this really. I’m not sure what the best solution is.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:24:14+00:00Added an answer on June 17, 2026 at 8:24 pm

    To get the various divs to wrap you’ll need to float them. I have a working example, but the margins are being difficult.

    http://jsfiddle.net/jzgSP/3/

    #thumb-container, #thumb-container2 {float: left;}
    

    UPDATE: Getting closer by using margins on #thumb-wrap rather than padding on the containers: http://jsfiddle.net/jzgSP/4/

    UPDATE AGAIN: I’m working in Firefox, and the only way to get the elements to clear each other 100% of the time as you have them set up is to use odd div widths. I haven’t been able to determine why, but my guess is that border thickness calculation is at play.

    http://jsfiddle.net/jzgSP/7/

    #thumb-container {width: 24.01%;}
    #thumb-container2 {width: 48%;}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.