What's the best way to eliminate blank space in my Bootstrap grid columns?

I'm facing an issue with the search filter layout on my website. It includes input fields for a search term, two datepickers, and two buttons:

        <div id="search-holder">
            <div id="search-box">
                <div class="form-group row">
                    <div class="col-lg-10 col-md-9 col-sm-9 form-group row">
                        <div class="col-lg-8 col-md-8 col-sm-6">
                            <input id="searchResident" type="text" class="form-control search-input col-md-10" data-bind="value: mainDataSearchWorker, valueUpdate: 'afterkeydown', enterkey: mainDataRefreshData" placeholder="@SharedResources.Index.SearchNurse" />
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-3">
                            <input id="searchIntakeDateFrom" type="text" class="form-control search-date pointer picker" data-bind="datePicker: mainDataSearchDateFrom, maxDate: mainDataSearchDateTo, valueUpdate: 'afterkeydown', enterkey: mainDataRefreshData" placeholder="@SharedResources.Index.SearchDateFrom" />
                        </div>
                        <div class="col-lg-2 col-md-2 col-sm-3">
                            <input id="searchIntakeDateTo" type="text" class="form-control search-date pointer picker" data-bind="datePicker: mainDataSearchDateTo, minDate: mainDataSearchDateFrom, valueUpdate: 'afterkeydown', enterkey: mainDataRefreshData" placeholder="@SharedResources.Index.SearchDateTo" />
                        </div>
                    </div>
                    <div class="col-lg-2 col-md-3 col-sm-3 form-group row">
                        <div>
                            <button type="button" id="search" class="btn btn-newline" data-bind="click: function() {mainDataRefreshData()}"> @SharedResources.Index.Search</button>
                            <button class="btn btn-sm leftmargin10" title="@SharedResources.Index.Reset" data-bind="click: function() {mainDataResetSearch()}">
                                <span class="fa fa-repeat"></span>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    

There seems to be an issue with the "searchResident" input field not fully stretching, creating empty space between the input field and datepicker field:

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

Is there a way to make the "searchResident" input field stretch fully to eliminate the empty space between input elements?

https://www.bootply.com/EAkJ1KHlla

Answer №1

    <input id="searchResident" type="text" class="form-control search-input 
**col-md-10**" data-bind="value: mainDataSearchWorker, valueUpdate: 
'afterkeydown', enterkey: mainDataRefreshData" placeholder="@SharedResources.Index.SearchNurse">

The input field currently has a col-md-10 class which limits its width to 83% of its container.

If you change it to col-md-12, it should resolve the issue you are facing.

Answer №2

You currently face two issues:

1) The input width is constrained to 10 columns using col-md-10, when in reality it should span the full 12 columns.

2) The columns are not being nested correctly, leading to confusion on when to use them as rows or not adding new rows at all. Follow the documentation guidelines for proper nesting by creating a new row below the parent column and only placing nested columns inside this new row. Refer to this example from the documentation:

<div class="row">
  <div class="col-sm-9">
    Level 1: .col-sm-9
    <div class="row">
      <div class="col-8 col-sm-6">
        Level 2: .col-8 .col-sm-6
      </div>
      <div class="col-4 col-sm-6">
        Level 2: .col-4 .col-sm-6
      </div>
    </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

glsify - encountering the error message 'This file type could require a specific loader to be handled'?

Currently, I'm attempting to implement a custom shader following the guidance provided at https://tympanus.net/codrops/2019/01/17/interactive-particles-with-three-js/. I have imported the .frag and .vert files (provided in the link) and replicated the ...

Ways to change the role link in child elements inherited from the parent in terms of Accessibility

How can I create a tooltip with dynamically added tooltip content div requiring a role link for the aria label to be appended as needed? The initial HTML of the tooltip before expansion is: <div class="tooltip" tabindex="0" aria-expa ...

Unable to center label when adjusting TextField height beyond default

I was tasked with reducing the size of the MUI Component TextField by 4px. To achieve this, I modified the root & .MuiOutlinedInput-input. Although it adjusted the height as desired, the label (Email) is no longer vertically centered. I attempted to so ...

Converting a string to regular text in JavaScript (specifically in ReactJS)

When I fetch data from an API, sometimes there are special characters involved. For example, the object returned may look like this: { question : "In which year did the British television series &quot;The Bill&quot; end?" } If I save t ...

Unexpected white space appears at the bottom of the page when rotating the device in iOS Safari

One issue I encountered on my website involves a meta tag: <meta name="viewport" content="width=device-width, initial-scale=1.0"> This, combined with height:100%; on the html and body tags, causes problems when viewed on Safari ...

tips for creating dynamic visual effects using CSS on filtered images

img:hover{ -webkit-filter: grayscale(100%); -moz-filter: grayscale(100%); filter: grayscale(100%); } This CSS code snippet will convert the image from color to grayscale upon hovering. However, I am looking to achieve this effect with a smooth animation ...

Here's a unique rewrite: "Learn how to manipulate the CSS class of a textarea element (specifically in NicEdit) by utilizing the addClass

I am currently validating a textarea using the NicEdit plugin. var getContent = nicEditors.findEditor("SubSliderDescription").getContent(); bValid = bValid && checkBlankTextArea(getContent, "SubSliderDescription") function checkBlankTextArea(o, ...

Dynamic flexibility for content scrolling across components

Creating a mobile-friendly terms of service page with a title, content, and two buttons is my current project. The specific requirements are: All components should not exceed 100% of the viewport to allow for scrolling The buttons need to stay sticky at t ...

Unable to get font-face to function properly on IE versions 7 and 8

I'm having trouble getting the font-face to work properly on both IE7 and IE8. This is the code snippet I have used: @font-face { font-family: 'DroidSans'; src: url('fonts/DroidSans.eot'); src: url('fonts/DroidSa ...

Beginner tips for adding padding in CSS

Could anyone clarify a discrepancy in the material provided here: w3schools.com code example According to the code : th,td { padding:5px; } Also, based on their explanation here: http://www.w3schools.com/cssref/pr_padding.asp The explanation states tha ...

The fixed-top navbar in Bootstrap 5 is not displaying the toggle button

I have encountered an issue with the Bootstrap 5 navbar. When I set it to be fixed at the top, the toggle button does not show up when resizing the browser window. However, if I remove the 'fixed-top' class, the toggle appears as expected. What c ...

analyze and respond to inquiries

Imagine there is a question titled Q1 with four radio answer options: Q1: a) b) c) d) If you were using Python, what steps would you take to locate the question, choose one of the answers, and then submit the webpage? ...

What is the best way to incorporate several functions within a resize function?

Is it possible to incorporate multiple functions within the windows.width resize function? I have been experimenting with some code, but I would like to restrict its usage to tablet and mobile devices only, excluding laptops and PCs. Any suggestions on h ...

How does CSS affect the size and performance of a website?

Examining the content of this css file (focusing on the last 5 lines specifically): #page section .s_1 { overflow:hidden; width:435px; float:left;} #page section .s_1 h1 { font-size:36pt; color:#001744; line-height:1.1; margin-bottom:64px;height:107px;} # ...

I am encountering issues with the ng-bootstrap drop down menu not functioning properly when used in conjunction with *ng

The dropdown menu is designed to dynamically populate a selection of languages. I attempted to use ngFor to achieve this, but only the first item in the list appears in the dropdown menu. <nav class ="navbar navbar-light bg-light fixed-top"> &l ...

D3 bar chart displaying identical values but with varying data sets

<!DOCTYPE html> <html lang='en'> <head> <meta charset="UTF-8"/> <title>Interactive Bar Chart using D3</title> <script src="https://d3js.org/d3.v4.min.js"></script> </head> <b ...

Inconsistent behavior of transform scale() between Chrome and Safari upon page refresh

My goal was to design a code that would adjust all content according to the browser size, ensuring that everything remains visible even when the window is resized. var docHeight = $(document).height(); var winHeight; var zoomRatio; function z(number) { ...

Newly designed Bootstrap 4 input field with search feature positioned off-center on smaller screens

I have successfully positioned an input text next to a button as shown below: While it displays perfectly on a regular computer screen, the alignment gets skewed when viewed on a phone device: This is the functional code I am using: <!-- Add Filer Fo ...

Arrange divs in a float-stacked formation next to each other, without the need for a

I'm facing a challenge trying to display stacked divs in a column-like manner. Unfortunately, I can't directly edit the HTML due to the constraints of the application. The issue I'm encountering is that the right column is appearing lower do ...

I am looking for a way to have one element as a child of another element without automatically adopting specific properties

https://i.sstatic.net/iuNB7.png <span id="priority-dot-open-menu"> <span id="priority-menu"> <span class="tooltip-top"></span> <span id="priority-dot-blue">& ...