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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:36:30+00:00 2026-05-23T20:36:30+00:00

I have two boxes like: <div class=box> <div class=content>Here goes content 1.</div> </div> <div

  • 0

I have two boxes like:

<div class="box">
    <div class="content">Here goes content 1.</div>
</div>
<div class="box">
    <div class="content">Here goes content 2.</div>
</div>


.content {height:150px;width:65px;}

Now it can be that the text of content 1 doesn’t fit the height of 150px. The div stretches.
How can I achieve that the class changes the height so that the second content will have the same height as content 1?

  • 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-05-23T20:36:31+00:00Added an answer on May 23, 2026 at 8:36 pm

    This does not feel too elegant, but it works (at least in FF, Chrome and Safari for Mac, as I did not have the time to test it in IE):

    <script type="text/javascript">
       window.onload = function() {
           var minHeight = 150;
           var contentDivs = [];
           var divs = document.getElementsByTagName("div");
    
           // find the content div with the tallest height
           for (var i=0; i < divs.length; i++) {
              var div = divs[i];
              if (div.className == "content") {
                 minHeight = Math.max(minHeight, div.offsetHeight);
                 contentDivs.push(div);
              }
           }
    
           // set the content divs' height to the tallest height
           for (var j=0; j < contentDivs.length; j++) {
              var contentDiv = contentDivs[j];
              contentDiv.style.height = minHeight + "px";
           }
       }
    </script>
    
    .content {width:65px;}
    

    Don’t forget to remove the height:150px from your css or the height of the elements won’t be adjusted.

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

Sidebar

Related Questions

I have created two rounded corner boxes which i would like to be aligned
In the following HTML/CSS code I'm having two issues: The result class boxes have
I currently have two text boxes which accept any number. I have a text
I have a form in VB6 with two combo boxes (cboCustomer and cboItemNumber). When
I have two classes, and want to include a static instance of one class
I’ve two div boxes that I’m using as a expand-collapse with some javascript but
I have two <div> s on my page. I want to arrange them side-by
I have two list boxes with one to one mapping. They are also scrollable.
I have made a frame in which i have put two jTextfield boxes where
I am presently working on two different linux boxes in the same network. Now

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.