Struggling to achieve consistent height for each div table box

Currently working on creating a table using CSS and divs, and I've got most of it set up except for the issue of uneven heights in the boxes. I've tried adjusting the heights and various commands, but to no avail. I'm unsure whether the problem lies in the CSS provided or if there's a conflict with other CSS coding.

CSS:

.collection{
    width:600px;
    border-collapse:collapse;
}
.collection td{
    padding:5px;
}
.collection-box{
    border-style:solid;
    border-width:2px 2px;
    border-color:#29FDF1;
    background: rgba(11, 14, 15, .65)
    height:100%;
    display:inline-block;
    padding:5px 5px;
}
.collection-innerbox{
    display:inline-block;
    background: rgba(11, 14, 15, .65)
    text-align:center;
    width:200px;
    height:200px;
}
.collection-text{
    text-align:center;
}

JSFiddle Full site's CSS on Pastebin

Answer №1

To make it work, simply change the vertical-align to top and include a 100% height for the main inner div.

.collection td { vertical-align: top; }
.collection-box { height: 100% }

Check out the Fiddle here

Note : Don't forget to add a comma after the background value in this section:

.collection-innerbox{
    display:inline-block;
    background: rgba(11, 14, 15, .65),
    text-align:center;
    width:200px;
    height:200px;
}

Answer №2

You're almost there. Make sure to apply the border to '.collection td' rather than '.collection-box'

.collection td {
    padding: 5px;
    border-style: solid;
    border-width: 2px 2px;
    border-color: #29FDF1;
    vertical-align: top;
}

If you want some space between them,

.collection td {
   vertical-align: top; 
  }
 .collection-box { 
   height: 100% 
  }

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

Are HTML files and PHP generated files cached differently by web browsers?

My current setup involves Nginx as a web server and Firefox to check response headers. I added two files on the server - test.html and test.php, both containing the same content. In the Nginx config file, I have set the expires directive to 30d in the serv ...

Obtain and retrieve media URL (m3u8) with the help of PHP

I am currently working on a project that involves hosting videos for a client on a website. The videos are loaded externally through m3u8 links on the site. Now, the client has expressed interest in having these videos available on a Roku channel as well. ...

Navigating through cpanel to interact with a Button using Selenium in Python

Unable to select the new folder option. Here is what I have attempted: driver.find_element_by_id("li.action-newfolder") driver.find_element_by_xpath("//[a(text(), 'New Folder')]").click() Unfortunately, neither of these methods are successful. ...

The function is not functioning correctly for every element within the array

I am currently developing a shopping cart that populates data from local storage. Here is a snippet of the code: var arrayLength = cartarry.length; for (var i = 0; i < arrayLength; i++) { var id = cartarry[i].id; var name = cartarry[i].name; ...

Flexbox allows for the overflow of images within a container

Need help keeping my images from overflowing the <div class="display"> container and maintaining a square/box shape It should work with flexbox. Currently, the code displays 3 images with 1 extending outside the box, which is not the desired outcom ...

When the HTML content matches a specific value, initiate a click event to trigger

Can anyone help me troubleshoot? I've tried multiple methods but can't seem to get it right. Here's a breakdown of what I'm attempting to accomplish: #info-NUMBER-btn shows Click to display more information. #info-NUMBER CSS is set t ...

Using CSS min-height: 100vh will ensure that the container has enough height to fill the entire viewport

Utilizing min-height: 100vh; in my inner call to action div placed on top of a background video has been mostly successful. However, I've encountered an issue where using 100vh with the absolutely positioned video seems to introduce an unwanted margin ...

Attitude: Defiant and Ignoring Authority

So far, no suggestions have been made, indicating that maybe I haven't properly summarized the issue; The problem arises when I absolutely position the section with the class="container" using an additional class or id specific to that <div>. I ...

VS code is showing the directory listing instead of serving the HTML file

Recently, I attempted to use nodejs to serve the Disp.html file by following a code snippet from a tutorial I found on YouTube. const http = require("http"); const fs = require("fs"); const fileContent = fs.readFileSync("Disp.html& ...

Create custom buttons in Material-UI to replace default buttons in a React modal window

How can I prevent overlay on material-ui's RaisedButton? When I open a modal window, the buttons still remain visible. Which property should be added to the buttons to disable the overlay? Any assistance from those familiar with material-ui would b ...

Having trouble with syntax highlighting on Node.js Vash view files in Visual Studio 2015 Update 3?

While working on a Node.js application using Vash as the view engine in Visual Studio 2015 Update 3, I encountered an issue with syntax highlighting. When writing HTML in the vash files, the code appears as plain text without any syntax highlighting. For e ...

I am unable to connect my jQuery

I've searched far and wide on numerous coding forums for solutions to this issue. It's usually just minor syntax mistakes like forgetting a closing tag or improper src attribute formatting. Despite double-checking, my html and js seem to be erro ...

Propelling Information using the Chakra-UI Drawer Element

I've been exploring the features of the Chakra-UI drawer component and you can find more information about it here. Overall, the functionality aligns with my needs, except for one particular aspect - instead of pushing the content to the side, the dra ...

Issue with PrimeFaces radiobutton styles not updating after being clicked programmatically

My setup includes a p:selectOneRadio constructed like this: <p:selectOneRadio id="positionRadio" value="#{employeeBean.empPosition}" converter="#{empPositionConverter}" layout="custom" required="true" requiredMessage="Please select ...

Loading texts with the same color code via ajax will reveal there are differences among them

I am currently designing a webshop with green as the primary color scheme. Everything is functioning perfectly, but I have noticed that the text within an ajax loaded div appears brighter than it should be. The text that loads traditionally is noticeably d ...

The Ajax request is frozen in the POST method

Currently, I have a basic webform consisting of textareas that are used to input data through CGI into a SQL database and this is functioning as expected. However, my issue arises from the fact that besides using <input type='submit'/> to ...

Is there a way to deactivate a div in Blazor when clicking outside of the div?

Is it possible to have two divs on a single page, where one appears on the right side and the other on the left side? Is there a way to close or hide the left side div whenever we click on the right side div? ...

jQuery functions smoothly on Firefox, but encountering issues on Chrome

While it may seem like a repetitive inquiry, I have thoroughly researched similar questions and have not found a suitable solution. The server is returning the following response through a standard ajax call: <form id="ctl00" name="ctl00" method="post ...

The function "getElementsByClassName" in Javascript is malfunctioning

I have redesigned my website by implementing an interactive feature where users can click on a tree image to remove it and replace it with a number using JavaScript. Initially, I targeted the specific tree with the following code: document.getElementById( ...

Exploring the Latest Features: Using Angular 7 with Bootstrap Collapse for Dynamic Aria-Controls

I am currently working on creating my own component to use within an *ngFor loop. I am facing an issue where I need a unique value for my Collapse feature. Right now, when I click on the second main row in the table, the collapse feature only shows the inn ...