What is causing the col-auto with the red border to exceed its available height?

For this code, I've utilized version 5 of Bootstrap. In full screen width, the col-auto with the red border seems to be taking up more space than its content. The yellow border marks the available content space inside. I'm curious about what might be causing this issue. Could someone please offer some assistance?

html,body{
  height:100%;
}
.search-field .form-control {
  padding-left: 2rem;
}

.search-field .form-control-search {
  position: absolute;
  z-index: 2;
  display: block;
  width: 2.375rem;
  height: 2.375rem;
  line-height: 2.3rem;
  text-align: center;
  pointer-events: none;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="73111c1c0700070112035e1a101c1d0033425d42425d40">[email protected]</a>/font/bootstrap-icons.min.css" rel="stylesheet"/>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="94f6fbfbe0e7e0e6f5e4d4a1baa7baa7">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <section class="container-fluid h-100">
    <div class="row flex-column h-100">
        <div class="col-auto py-2 border border-danger bg-light-subtle">
            <div class="row g-0 align-items-center border border-warning">
                    <div class="col-auto pe-2">
                        <div class="rounded bg-dark text-light p-1 lh-1">
                            <i class="bi bi-person-check align-middle lh-1"></i>
                        </div>
                    </div>
                    <div class="col-4 align-self-end">
                        <h6 class="fw-bold text-truncate pt-1">Assigned</h6>
                    </div>
                    <div class="col col-lg-4 ms-auto">
                        <form class="pr-2">
                            <select class="form-select" aria-label="Default select example">
  <option selected="">Open this select menu</option>
  <option value="1">One</option>
  <option value="2">Two</option>
  <option value="3">Three</option>
</select>
                        </form>
                    </div>
                    <div class="col-auto">
                        <hidden id=""></hidden>
                        <button id="" class="btn btn-outline-primary border-0 ms-2">
                            <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="align-middle" viewBox="0 0 16 16" style="">
                                    <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"></path>
                                    <path d="M8 4a.5.5 0 0 1 .5.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3A.5.5 0 0 1 8 4"></path>
                                </svg>
                        </button>
                    </div>
                    <div class="col-auto form-group mb-0 search-field position-relative ps-2">
                        <span class="fa fa-search form-control-search"></span>
                        <input type="text" placeholder="Search" class="form-control text-muted search" id="">
                    </div>
                    <div class="col-auto ps-2">
                        <button class="btn btn-outline-primary border-0">
                            <i class="bi bi-grid"></i>
                        </button>
                    </div>
                                
                </div>
        </div>
        <div class="col position-relative bg-light" style="min-height: 0;">
            
        </div>
    </div>
</section>
</body>
</html>

Answer №1

UPDATE Upon further review, it appears that the issue stems from col-auto adding the flex shorthand property

flex: 0 0 auto;

The final value (auto) represents the flex-basis https://developer.mozilla.org/en-US/docs/Web/CSS/flex-basis

In your code, you have 2 columns with a column direction set to "column". Since the first column has a flex-basis of "auto" and the second one is set to "0", the col-auto class causes the first column to take up any extra space within the parent row(h-100).

This issue only occurs on desktop viewports

PREVIOUS ANSWER The py-2 class next to col-auto is causing this problem as it adds inner padding to the outer div container


<div class="col-auto border border-danger bg-light-subtle"></div>

To resolve this, simply remove the py-2 class

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

The MDL layout spacer is pushing the content to the following line

Here's an interesting approach to Material Design Lite. In this example from the MDL site, notice how the 'mdl-layout-spacer' class positions elements to the right of the containing div, giving a clean layout: Check it out <!-- Event ca ...

The JQuery chosen dropdown experiences a visual issue when placed inside a scrollbar, appearing to be "cut

Good day, I've been using the jQuery "chosen" plugin for a dropdown menu, but I encountered an issue with it being located in a scrollable area. The problem is that the dropdown items are getting cut off by the outer div element. I have provided a si ...

Exploring Bootstrap's Product sample and attempting to understand the process of incorporating images

Currently, I am utilizing Bootstrap 4 and taking advantage of their Product example as a foundation: https://getbootstrap.com/docs/4.4/examples/product/ My goal is to transform the white and gray background sections into actual images of the product. The ...

Display a popover when the button is clicked using jQuery

Is there a way to show a notification message using popover? I've managed to make it work, but I'm facing an issue where the popover doesn't appear on the first click of a button after the page loads. Here is the code snippet: <button ty ...

On three out of five pages, Mozilla Firefox and Internet Explorer are causing extra spacing in my navigation section, yet not on every page

I've been troubleshooting my website and can't seem to pinpoint the issue. I have 5 pages all connected to the same CSS file and created in a consistent manner. Interestingly, Safari, Chrome, and Opera display everything correctly. However, in Fi ...

Maintaining the order of elements in Angular's insertion process

I am currently facing an issue with my HTML fragment that iterates over a key and value collection. Everything works perfectly when I insert values into an object and iterate through it using the HTML fragment. However, in order to maintain a specific key ...

unable to download file and missing image display

I need assistance with creating a download link using the anchor tag in my code. However, the link is not working as expected and the image is not displaying either. <td><img src="{{book.book_image}}" alt="{{book.name}}" width= ...

Steps for Deactivating Past Dates on JQuery Datepicker1. Open your

I've been working on a custom JQuery Calendar for selecting appointments, with the requirement to disable dates prior to the current date and highlight available dates in an orange color (#f48024). Unfortunately, my attempt using minDate hasn't b ...

Troubles with implementing child routes in Angular 6

I'm having trouble getting the routing and child routing to work in my simple navigation for an angular 6 app. I've configured everything correctly, but it just doesn't seem to be working. Here is the structure of my app: └───src ...

Issue with Android date input field not resetting the value

When testing in Android Tablet (version 4.1.2), I encountered a strange issue with an input date field that looks like this: <input type="date" value="2013-06-10"/>. Upon clicking on the field and trying to set a new date, instead of replacing the o ...

Fancybox is experiencing some technical difficulties

Can anyone help me troubleshoot why my fancybox code isn't working properly after adding the script below to the body? Any thoughts on what might be causing this issue? $(document).ready(function() { $("a#example4").fancybox({ 'opa ...

Global variable appears undefined in Angular 2 view, yet it is still displaying

I'm running into issues with my Angular 2 code. Inside my ts file, I have the following: import { Test } from '../../../../models/test'; import { TestService } from '../../../../services/test.service'; import { Job} fr ...

Creating two columns with separate scrollbars in Responsive Bootstrap is a useful feature for organizing content in a visually

Is there a way to create 2 columns with scrollbars using Bootstrap when a button is clicked? Here's what I'm trying to achieve: My webpage consists of a row-fluid div that contains the main-column div with main-content and extra-content. There&a ...

Placing text at the bottom of a backdrop image

Looking for a way to position text at the bottom of a background image? Here's how you can do it: <div style="background-image: url('http://www.hdwallpapersinn.com/wp-content/uploads/2013/03/1325120512b60-45927-1.jpg'); height:100px"> ...

Can anyone provide guidance on locating the parent of a pseudo element with Selenium WebDriver?

Is there a way to retrieve the parent web element of a pseudo element (if we can call it the parent) using JavaScript? I know that Selenium's methods for searching for web elements are not suitable for pseudo elements, but JavaScript does allow manipu ...

Skip over the em tags while extracting the content from the class name using the Parsel selector

Is there a way to extract the contents of a specific class name, including what's inside and after 'em' tags? Refer to the image below for context: https://i.sstatic.net/FrYVv.png My attempted methods and the corresponding outcomes are as f ...

Could it be that the reason why document.getElementById is undefined in a Vue2 component is due to a misunderstanding

I am currently building a simple chat feature that fetches messages from Firebase and displays them in a div. The objective is to automatically scroll to the bottom of the div WHEN relevantMessages changes, as long as the current scroll position is close ...

The Remote_Host index is not visible

We have encountered an issue on our suse11 apache2.2 server when trying to retrieve the REMOTE_HOST information, resulting in an error message stating "index not found" shown below: REMOTE_HOST : Notice: Undefined index: REMOTE_HOST in /media/nss/VOL1/htd ...

Sharing HTML code from R to your Wordpress posts

I have successfully created an RMarkdown file that generates a visually appealing HTML page. You can view the output here: Now, my goal is to embed this HTML code onto our Wordpress site at: The challenge I'm facing is getting the content onto the p ...

The method to extract data from a <td> element using BeautifulSoup

There is a page I'm working with that contains tables in its source code: <td class="ng-binding">9:20 AM</td>, <td class="ng-binding"><span class="ng-binding" ng-bind-html="objFlight.flight.stat ...