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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:58:49+00:00 2026-06-15T09:58:49+00:00

Hy there, I’m experiencing some (understanding) problems with some HTML & CSS of mine.

  • 0

Hy there,

I’m experiencing some (understanding) problems with some HTML & CSS of mine.

I have multiple DIVs (.item) inside a parent DIV (.group). The height of those child DIVs depends on their content which is dynamic.

Working example with static content: http://jsfiddle.net/YfDWL/

HTML:

<div class="group">
    <div class="item">
        <div class="item-title">item 1</div>
        <div class="item-tag">tag1</div>
    </div>
    <div class="item">
        <div class="item-title">item 2</div>
        <div class="item-tag">tag1</div>
        <div class="item-tag">tag2</div>
        <div class="item-tag">tag3</div>
        <div class="item-tag">tag4</div>
    </div>
    <div class="item">
        <div class="item-title">item 3</div>
        <div class="item-tag">tag1</div>
        <div class="item-tag">tag2</div>
    </div>
</div>
<div class="group">
    <div class="item">
        <div class="item-title">item 1</div>
        <div class="item-tag">tag1</div>
        <div class="item-tag">tag2</div>
        <div class="item-tag">tag3</div>
        <div class="item-tag">tag4</div>
    </div>
    <div class="item">
        <div class="item-title">item 2</div>
        <div class="item-tag">tag1</div>
        <div class="item-tag">tag2</div>
    </div>
    <div class="item">
        <div class="item-title">item 3</div>
        <div class="item-tag">tag1</div>
    </div>
</div>

CSS:

.group {
    margin: 30px;
    padding: 10px;
    border: 1px dashed black;
}

.item {
    display: inline-block;
    border: 1px solid black;
    width: 100px;
    margin-right: 10px;
}

.item-title {
    text-align: center;
    font-style: italic;
    font-weight: bold;
}

What I would like to achieve is that all item DIVs inside a group should have the same height and should be aligned at the top. This brings me to a few problems:

  1. The alignment
    How can i align all item DIVs at the top of the group? Right now they are aligned at the bottom as you can see at the example…

  2. The height
    As I’ve seen in other questions it seems that this can’t be done with pure HTML/CSS. Therefore I’ve decided to use a little JS with JQuery to correct the height of the elements.
    Working example: http://jsfiddle.net/YfDWL/1/

JavaScript:

$(window).load(function() {
    "use strict";

    var maxHeight;

    // Iterate through every group
    $('.group').each(function(idx, group) {
        maxHeight = 0;

        // Iterate through every item of the group and save the max height
        $(group).find('.item').each(function(idx, item) {
            var height = $(item).height();

            if (!maxHeight || (height > maxHeight)) {
                maxHeight = height;
            }
        });

        // Set the max height to all items inside the group
        if (maxHeight) {
            $(group).find('.item').css('height', maxHeight);
        }
    });
});

As you can see, this is working ok, but the alignment still is a problem…

What I’d like to know now is where the alignment of the items comes from and how i could manage to put all items at the top of the group?

Additionally I’d love to here suggestions if the “same height”-problem could be solved more elegently and maybe without JS at all…

Thanks & best regards,
mik

  • 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-15T09:58:50+00:00Added an answer on June 15, 2026 at 9:58 am

    Add vertical-align:top

    .item {
        display: inline-block;
        border: 1px solid black;
        width: 100px;
        margin-right: 10px;
        vertical-align:top
    }
    

    DEMO


    You can refer this example to know how to get equal height without using js .

    DEMO 2

    http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks

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

Sidebar

Related Questions

There have been multiple questions regarding this topic but I have never really settled
I have just tried to save a simple *.rtf file with some websites and
There is this strange situation I'm fighting on. I have 3 pages, les call
There are numerous Agile software development methods. Which ones have you used in practice
There are some stdlib functions that throw errors on invalid input. For example: Prelude>
There is some contradiction in the api documentation: on one location: https://developer.foursquare.com/docs/responses/user on another
There was some progress made to the earlier problem. Now there is a new
There are a TextField , a ListBox and a TextArea inside my Form .
There is a component that I have been using since IE7 and had never
There is a properly formatted text in Html textarea which looks like : As

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.