Unable to achieve consistent sizes for left-floating div elements in HTML

I'm struggling with getting two float: left; divs to appear the same size despite trying everything:

https://i.sstatic.net/XTk9G.png

This is my first <div> css:

#container-div {
    overflow: hidden;
    display: table;
}
.first-column-container-div {
    width: 173px;
    float: left;
    margin-bottom: -500em;
    padding-bottom: 500em;
    display: table-cell;
}
.first-column-names-container-div {
    border: 1px solid black;
    width: 173px;
}
.first-column-names-h1 {
    -moz-transform: rotate(-90.0deg); /* FF3.5+ */
    -o-transform: rotate(-90.0deg); /* Opera 10.5 */
    -webkit-transform: rotate(-90.0deg); /* Saf3.1+, Chrome */
    filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083); /* IE6,IE7 */
    -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)"; /* IE8 */
    text-align: center;
    font-size: 1.3em;
}

As for the second <div>:

.second-column-container-div {
    width: 173px;
    float: left;
    display: table-cell;
}
.second-column-values-container-div {
    border: 1px solid black;
    border-left: none;
    display: table-cell;
}

Answer №1

To make the first box the same height as the second box, you can achieve this using JavaScript. Follow the code snippet below to accomplish it:

Start by retrieving the height of the second box:

var box2Height = $('.second-column-container-div').height();

Next, set the height of the first box to be equal to the height of the second box:

$('.first-column-container-div').height(box2Height);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Problem with Jquery HTML CSS Slideshow

Currently I am working on integrating two sliders into one webpage using the demo available at . One of the sliders is customized from the Linking demo and I have named them slider1 and slider2 with different styling using global.css for slider-1 and text. ...

`Evaluating and contrasting information within a jQuery iteration`

Recently, I encountered an issue with a dynamically built table on my page that contains editable data fields. Here is an example snippet of the table structure: <tr> <td class="identifier">1</td> <td class="c1&q ...

Enhance the CSS styling for the React-Calendly integration in a React project

I am trying to customize the CSS of an Inline Widget called React Calendly. I have attempted to use React Styled Component Wrapper, Frame React Component, and DOM javascript but unfortunately, the design changes are not reflecting as desired. Specifically, ...

Is there a way to create a new perspective for Ion-Popover?

Looking for a solution: <ion-grid *ngIf="headerService.showSearch()"> <ion-row id="searchbar" class="main-searchbar ion-align-items-center"> <ion-col size="11"> ...

Disabled screen rotation -> hidden background

I tried implementing a media query to "lock" the orientation on my mobile site, but unfortunately, my background image isn't displaying at all. After adding the media query, I included my stylesheet using the link: CSS body { padding:0; marg ...

Integrate buttons for increasing and decreasing with the `<select>` element in HTML

Apologies for what may seem like a trivial question, but I am truly stuck. Despite searching extensively, I cannot find how to create a basic HTML tag with increase and decrease buttons aligned to the right. Your assistance would be greatly appreciated. Th ...

How to turn off a sticky header on Mobile using CSS

Below is the code I am using to create a fixed header on my website. <?php } ?> <header id="header" class="<?php if ( theme_option( THEME_OPTIONS, 'enable_header_fixed' ) == 'true' ) : ?> fixed_header <?php else : ?&g ...

The combination of AddEventListener in the parent and postMessage in the iframe is ineffective

As I delve into the Stripe documentation to develop a new feature, I have encountered an issue regarding the communication between a webpage and an iframe. The code in index.html: <!DOCTYPE html> <body> parent<br> <iframe src="./ ...

Detecting coordinates (x, y) on a canvas

I'm currently working on a mini-game and encountering an issue with the player movement around the green square. My character seems to be unable to move past the x, y coordinates of the square, even though it can approach it closely. I would really ap ...

Ways to update a div periodically with new data fetched from a file - Here's How!

I am looking to auto-refresh a specific div every few seconds on my index.php page below. <?php session_start(); if (! check_write()) { redirect('testlogin.php'); return; } if (file_exists('lmt.json')) { $lmt = json_de ...

What could be the reason for the state not initializing with the provided value?

It seems that the latest value is being passed through props, but when it is set as the initial value for state, it doesn't appear. https://i.stack.imgur.com/7dVf2.png import React, { useRef, useState } from "react"; //importing config fr ...

Organizing Content with CSS/Bootstrap Grid Row Alignment

I'm struggling to figure out why there is extra space above the nested grid row. I want to center align it, similar to how you would do in Excel. Any suggestions on how to achieve this? My layout includes a fluid container with a nested grid row cons ...

What is the best way to implement pushstate degradation – using backbone.history or history.js?

I am interested in implementing pushstate functionality, which involves making an ajax request, changing the URL, and adjusting the browser history stack. However, since pushstate is not universally supported by all browsers, I need to find a workaround f ...

Occasionally, the popup fails to open when a button is clicked. What could be causing this issue? -Asp.net

Have you ever encountered issues with popups not working at times? It seems that there is no specific condition for the popup to appear. The expectation is that whenever a button is clicked, the popup should show up. Where do you think the problem lies in ...

What is the process for enabling HTMLField in Django Admin and ensuring it is accurately displayed on the template?

One of the models in my Django app is for dorms and it looks like this: class Dorm(models.Model): dorm_name = models.CharField(max_length=50, help_text="Enter dorm name") dorm_description = models.TextField(max_length=1000, help_text="Enter dorm d ...

Having trouble displaying images on iPhone 6

I am facing an issue with the background image of one of my elements. The image loads perfectly on most devices such as iPhone 5, iPhone 5c, and Samsung Galaxy, but it does not load on iPhone 6, iPhone 6 Plus, and some iPads. Can anyone provide insights ...

Adjust the hue of a figure based on the color input using JavaScript

I recently implemented a colorPicker and now I want to extract the value from it and apply it. Here is what I have used: <li id="color"><input type="color" name="color" onchange="changeColor()"></li> function changeColor(){ var se ...

On an iPad, a margin-centered button will unexpectedly shift to the left

I have a button element: <div id="body"> <button>Hello</button> </div> Here is the CSS styling for the button: #body{ width:400px; margin:0 auto; background:#eee; border:1px solid #ccc; } button { display: ...

Adjusting font sizes based on window dimensions

I am currently in the process of building a website that requires the inclusion of images along with corresponding headings and descriptions. When viewing the website in full screen, the heading displays on a single line. However, as the browser width decr ...

What is the best way to have my hamburger menu button switch colors after being clicked?

I am currently working with Bootstrap and I am attempting to change the background color of the hamburger menu button once it has been clicked. While I can successfully modify the color within the browser inspection tool, I am struggling to replicate this ...