Achieving equal column heights with objects that fill the entire space

Check out this CSS playground for experimentation: https://www.bootply.com/HHeQ3n0EbT

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

<div class="container">
                <div class="row">
                    <div class="col ltg-column-parent">
                        Column
                        <div class="ltg-column-inside">
                            <div class="task-box">
                                content
                            </div>
                          <div class="task-box">
                                content
                            </div>
                          <div class="task-box">
                                content
                            </div>
                        </div>
                        <div class="task-table-bottom-buttons">
                            <button>+</button>
                        </div>

                    </div>
                  <div class="col ltg-column-parent">
                        Column
                        <div class="ltg-column-inside">
                            <div class="task-box">
                                content
                            </div>
                        </div>
                        <div class="task-table-bottom-buttons">
                            <button>+</button>
                        </div>

                    </div>
                  <div class="col ltg-column-parent">
                        Column
                        <div class="ltg-column-inside">
                            <div class="task-box">
                                content
                            </div>
                        </div>
                        <div class="task-table-bottom-buttons">
                            <button>+</button>
                        </div>

                    </div>
                </div>
            </div>

CSS:

.ltg-column-parent {
    margin: 1px;
    padding: 0;
    background-color: lightgray;
    padding-bottom: 1rem;
}

.ltg-column-inside {
    background-color: rgb(151, 151, 151);
    height: 100%;
    /* border: white solid 1px; */
}

.task-box {
    width: 10rem;
    height: 6rem;
    color: black; 
    background-color: white;
    border: 1px solid lightgray;
    border-left: 7px solid yellow;
    padding-left: 1rem;
    padding-top: 1rem;
    display: inline-block;
}

.task-table-bottom-buttons {
    position: relative;
    bottom: 0px;
}

This project involves creating a kanban table where tasks can be created and moved between columns.

  • The columns have a light gray background.
  • The dark gray div is where task boxes reside or can be dragged.

However, there are some issues in the design. The dark gray box with the "+" button is extending beyond its parent light gray div because it is set to height: 100% to utilize all available space. Removing this causes the dark gray div to shrink, limiting the space for tasks.

To address these challenges, we aim to achieve the following:

  • Ensure columns have equal heights only when placed next to each other (not necessary if stacked).
  • Position the "+" button at the bottom of the last task or the entire column.
  • Optimize the size of the dark gray div to allow ample space for dropping tasks without artificially altering the column height.

What steps should be taken to rectify these display issues?

Answer №1

I have found the perfect solution:

.ltg-column-inside {
    background-color: rgb(151, 151, 151);
    border: white solid 1px;
    display: flex;
    overflow: auto;
    height: auto;

}

https://i.stack.imgur.com/Aw9jW.png

Answer №2

apply dispaly:flex to the elements with class .ltg-column-inside

.ltg-column-inside{
dispaly:flex
}

if you prefer not to have the grey section, simply delete this:

.task-box{
    height: 6rem;
}

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

Guide to populating a select-option dropdown using CSS

I'm working on creating a dropdown menu in HTML that pulls the options from a CSS file. To accomplish this, I have assigned custom classes to each option and specified the option label in the CSS using the CUSTOM_CLASS::after{content: "";} r ...

Enhancing an image with zoom effect in a 2-column layout on hover

Could someone help me achieve a 2-column layout where the left column contains text and the right column an image? I want the image in the right column to zoom when the user hovers over either the left or right column. The issue is that when the user hove ...

Adjusting Renderer Size in ThreeJS for Fullscreen Display

After creating a ThreeJS application designed for a 4:3 layout with multiple buttons and features, I decided to enable Fullscreen mode using THREEx.Fullscreen.js. Although the Fullscreen mode is functioning properly, a new issue arose - the renderer size(x ...

Creating sibling classes with tailwind using the map function

Currently, I am combining tailwind, react, and nextjs to develop a website. My goal is to implement the check radio button technique to dynamically display different content on the website without relying on JavaScript. To streamline data management, I am ...

Implementing pagination in list/grid format using PHP, Bootstrap, and CSS

I'm currently developing a search page that offers both list and grid view options. I'd like to incorporate pagination into the code, but I'm unsure of the best approach. There seems to be a bug on this page as well - when I refresh the pag ...

What is the best way to align a form in the center of a page both horizontally and vertically

Currently, this is the HTML code I am working with: <body> <form id="form_login"> <p> <input type="text" id="username" placeholder="username" /> </p> ...

Tooltip Bootstrap timing

I am currently working on creating a navigation bar with icon-only buttons that display tooltips when touched or tapped. Here is the code I have implemented: $('a[rel="tooltip"]').tooltip({ animated: 'fade', placement: ' ...

Obtain the WordPress footer while applying a specific CSS rule

I need to customize my Wordpress template so that a specific css class is applied to a certain element. Currently, I am loading the footer in my templates using the <?php get_footer(); ?> function. However, I would like to load the footer with the . ...

Ways to change specific CSS class properties in a unique style

As a Java programmer using primefaces 5.1, I've encountered some challenges with handling CSS classes. One particular issue I'm facing is the need to override certain CSS properties to remove the rounded corners of a DIV element. The rendered cod ...

How to Achieve Seamless Vertical Scrolling Through Clicking a Button

I'm currently working with Bootstrap 4 Modal and have removed the Overflow-Y (ScrollBar) to enhance the design. However, I've also incorporated a function with two buttons (Up & Down) using JavaScript to facilitate easier navigation for users. Th ...

Move cursor over the element with a specified attribute

Is it possible to apply a hover effect to an active element without using the disabled attribute? I attempted the code below, but unfortunately, it did not produce the desired hover effect. input.btn:not([disabled]):hover ...

Tips for perfectly aligning the content in a flexbox item vertically

Is there a way to vertically center the contents of a flexbox item while using justify-content:stretch;? The old method of using display:table-cell;vertical-align:middle; does not seem to work in this scenario. Is there an alternative solution? .flex-cont ...

Ensure the footer remains at the bottom of the page without utilizing a minimum height of 100

When trying to address the common issue of making the footer stay at the bottom of a page, one popular solution is to enclose everything in a div with position:relative and min-height:100%, as explained in this helpful tutorial here. The challenge arises ...

Content in an adaptable image map and its regions

I have implemented an image map structure like this. <div class="container"> <div class="row"> <div class="col-lg-12"> <img src="..." style="width: 100%;" usemap ...

Display or conceal various content within div elements using multiple buttons

I have a set of 5 image buttons, each meant to trigger different content within a div. When the page loads, there should be default content displayed in the div that gets replaced by the content of the button clicked. The previously displayed content shoul ...

JSF's rich:datatable allows for displaying lengthy text in columns across multiple lines

On a JSF .xhtml page, I am using a richdatatable and have encountered an issue with displaying long text in a particular cell. How can I set the width of the column to ensure that the text wraps around and displays properly within the specified cell? As ...

Prevent vertical scrolling on touch devices when using the Owl Carousel plugin

Is there a way to prevent vertical scrolling on Owl Carousel when dragging it horizontally on touch devices? It currently allows for up and down movement, causing the whole page to jiggle. If anyone has a solution, I can share the JavaScript file. Appreci ...

Organizing search findings in a JavaScript table

What I'm currently doing is using document.write in my application to display search results to the user. However, I want these results to be shown in a table within <div class="main">. The catch is that I don't want the table visible at th ...

Fixing display flex with columns of percent width and 1px gap: A step-by-step guide

When displaying flex columns with percent width on a specific width, make sure to leave a 1px gap between them. Check out the screenshot here html, body { margin: 0; padding: 0; } * { box-sizing: border-box; } .wrapper { max-width: 1200px; p ...

Eliminate JavaScript that blocks rendering:

Currently, I am working on optimizing my website's speed and aiming for a perfect 100/100 score on PageSpeed Insights. The website in question is www.chrispdesign.com. Despite my efforts to relocate the code and make necessary adjustments, I have bee ...