Creating uniform heights for HTML column-based tables using divs in a React environment

I am developing a unique column-oriented and div-based table using React with Typescript. The data outside the table is organized in a column-based structure, rendering column 1 followed by row 1, row 2, row 3, then column 2 with its respective rows.

The issue arises when the height of a cell varies due to one cell being taller than the others. I desire for this custom div-based table to function like an HTML table tag, ensuring uniform cell height.

How can I ensure that the height of cells within each row are consistent, even if the heights vary between cells within the same row?

I aim for the height of cells within each row to be set to the highest height among all cells within that row, regardless of any differences in individual cell heights.

View Current Layout

Expected Outcome

React Tag Structure

Answer №1

It seems like there is an issue with the structure of your HTML.

.table {
    display: table;
    width: 100px;
}
.header{
    display: table-cell;    
}
.row {
    display: table-row; 
}
.cell {
    display: table-cell;
    border: 1px solid red;
}
<div class="table">
    <div class="row">
        <div class="header">Header</div>
        <div class="header">Header</div>
        <div class="header">Header</div>
    </div>
    <div class="row">

        <div class="cell">cell adasd dadad wd rwr r ewrewrrere</div>
        <div class="cell">cell</div>
        <div class="cell">cell</div>
    </div>
    <div class="row">

        <div class="cell">cell</div>
        <div class="cell">cell</div>
        <div class="cell">cell</div>
    </div>
</div>

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

What is the best way to adjust the content of a Bootstrap Column to be at the bottom of the column

Currently diving into the world of Bootstrap for my personal website, I'm encountering a challenge in aligning the content of my sidebar to the bottom. My quest for a solution led me through numerous threads without success. <!-- wordsmith: < ...

Property finally is missing in the Response type declaration, making it unassignable to type Promise<any>

After removing the async function, I encountered an error stating that the Promise property finally is missing when changing from an async function to a regular function. Any thoughts on why this would happen? handler.ts export class AccountBalanceHandle ...

Include a clickable hyperlink within a column in JQGrid that, when clicked, triggers a specific Jquery function

I am dealing with a JQgrid that only has 5 columns. Below is the code I have attempted: jQuery("#grdAnn6InvstDetails").jqGrid({ url: RootUrl + 'FDIAS/Ann6InvDtlsGridData', datatype: 'json', mtype: 'POST&ap ...

Incorporating timed hover effects in React applications

Take a look at the codesandbox example I'm currently working on implementing a modal that appears after a delay when hovering over a specific div. However, I've encountered some challenges. For instance, if the timeout is set to 1000ms and you h ...

Transform a traditional class component into a functional component

Is there a way to successfully convert this class component into a function component despite my previous failed attempts? componentDidMount(){ const id = this.props.match.params.id; getById( parseInt(id) ) .then(product => { this.setS ...

Adding a marker to Google Maps in React that displays the user's current location

I successfully integrated Google Maps into my website and now I want to add a marker for the user's location. The first file is Map.js, and the second one is MapContainer.js. In MapContainer.js, I have all the necessary data for map rendering, includi ...

Error: The function `map` is not applicable to MemberStore.members

Working on a small web application using React and Mobx, with the goal of connecting it to a Rails backend. I've set up a MemberStore containing an async fetchAll() method. import {observable, action, computed} from 'mobx'; class MemberSto ...

Showcase each video stored within a specific directory in the form of a list using HTML 5

I'm working on an application that requires me to showcase a series of videos on a single HTML5 page using the video tag. Despite successfully uploading files to my folder, I am struggling to display them properly. My search for a solution has been fr ...

Alignment of UI Divs with CSS Bootstrap and HTML

I am facing an issue with two divs in my UI. One div has a label, and the other contains a file selector. Currently, they are stacked vertically instead of being side by side. https://i.stack.imgur.com/fIz03.png How can I align these divs horizontally wit ...

What is the solution to adding values from a counter?

I am trying to create a JavaScript counter: function animateSun() { var $elie = $("#sun"); $({ degree: 0 }).animate({ degree: 360 }, { duration: 190999, easing: 'linear', step: function(val) { now = Math.round ...

Issues with React - Material UI Menu functionality

I'm encountering an issue with the menu/menu item component from material ui when trying to render it based on a condition. Here is my code snippet... const AddSelectItemButton = () => { return ( <> <Fab ar ...

The vertical scrollbar appears to be malfunctioning

I'm experiencing an issue where the scrollbar is visible but not functioning as expected. I am utilizing CSS for styling the scrollbar and other layouts, along with HTML to apply the styling. #sub_menu, #content{ display: inline-block; } #sub_ ...

When using angular.less, the @import feature is functioning correctly but a 404 error is displayed in the

Currently, I am working on a project using AngularJS along with angular.less. To centralize all my constants, I have stored them in one .less file and imported it at the beginning of all my other less files using a relative path: @import "constants" Even ...

Is there a way to make height: 100% adjust to accommodate other elements with specific pixel heights within the same div?

I am facing a challenge with a container that has a specified height and contains two nested divs. The first div has a height defined in pixels, and I want the second div to fill up the remaining space in the container, which is essentially 100% minus the ...

What could be causing the error in this test that utilizes Jest and react-test-renderer? Could it be due to the attempt to parse a .graphql file?

Starting off with Jest, I attempted a simple test but encountered an issue where it seemed like the entire app was being parsed. The error was pinpointed to a file referenced in the services file. If I exclude graphql from the regex for moduleNameMapper, ...

Preventing the Select component from constantly realigning

I am working with a Material UI Select component that allows users to select an entire category or specific items within the category. However, I have encountered an issue with the Select component realigning itself after a value is chosen. Is there a way ...

Using JQuery to enable checkbox if another is selected

I have a single checkbox that reveals a hidden div when checked. Inside this div, there are two additional checkboxes. My goal is to disable the initial checkbox if either of these two checkboxes is checked. Here's the HTML code snippet: <p> ...

Troubleshooting a problem with data retrieval in Hygraph and Next JS

I'm currently facing an issue while attempting to fetch data from Hygraph in a fresh Next JS application. The error message I'm encountering is: Error: Cannot read properties of undefined (reading 'map'). As a beginner in both technolo ...

What are the steps to create two frames using Twitter Bootstrap?

I'm just starting to work with Twitter Bootstrap and I need some help. Can someone assist me in creating a two-column layout inside the HTML, where the menu in the header stays visible even when scrolled down? I've included my HTML code below. Th ...

Why Bootstrap 4 collapse feature is not functioning correctly within a ReactJS map component?

I am currently working on a project that requires implementing a collapse feature. The idea is to display all available content when the user clicks the Read More button (which is functioning as intended for collapsing). However, I am facing an issue where ...