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 8490563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T22:09:42+00:00 2026-06-10T22:09:42+00:00

I have multiple <div> tag with same width but different height in a container.

  • 0

I have multiple <div> tag with same width but different height in a container. When the browser is resized and <div> elements are rearranged, they get a lot of spaces between. For example the following HTML:

<div class="wrap">
    <div class="box">
        This has less height
    </div>
    <div class="box">
        This has more height
    </div>
    <div class="box">
        This has less height.
    </div>
</div>

Now when the browser is resized, the last div will move to the left side below the first div, but there’s empty space between them because the middle div has more height. Please look at the image.

enter image description here
Is it possible to arrange these divs using pure CSS? I could not find a way, so I tried jQuery masonry plugin, that works ok but the problem is that it often does not resonse quickly (for example, when you open the page first time, the layout is totally messed up, but if you refresh the page it gets fine).

So if its not possible with CSS only, is there any way to make it work without complicated plugins (for example using jQuery only?)

jsFiddle:
http://jsfiddle.net/HS2Zh/

  • 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-10T22:09:43+00:00Added an answer on June 10, 2026 at 10:09 pm

    If your questing is to remove the gap, you can remove this by using this code

                var h = 0;
                $('.box').each(function() 
                { 
                    h = Math.max(h, $(this).height()); 
                }).height(h);
    

    It will assign the unique height(max height of .box) to all .box classes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple toggle divs on the same page, and the div I'm toggling
I have a container with different draggable -elements and there is a list of
I have a main Div tag with multiple div tags as below. The child
I have to create seven div elements in one hit - container A which
Here is the problem. I have multiple tag forms in my page. They are
I have multiple div tag's of post name in my page, what I want
I have multiple notes with class=.note and unique id each inside a div. On
How can have a div which contain multiple multiple div it may 4-6-8 how
I have multiple DIVs with unique IDs. Each DIV onclick slides down and shows
I have multiple input text fields grouped in divs: <div class=container0> <input class=containerItem0 name=containerItem[0][0]

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.