Problem of Input element becoming too small when the browser is resized

I'm having an issue with my contact form where the input fields shrink to a small size as the browser window shrinks. I've tried adjusting the col-breakpoints but it still doesn't look quite right until hitting the breakpoint. I also tried adding custom CSS to set a min-width, but haven't found success with that either.

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

<!-- Custom CSS -->
.input-group-text {
  width: 40px;
}
.input-group-text span {
  margin: 0 auto;
}

.body-main-bg {
  background-color: #eeeeee;
}

<!-- Contact Form -->
<div class="container-fluid">
        <div class="row body-main-bg justify-content-center">
                <div class="col-4 my-3 text-center">
                    <h4>Contact Us</h4>
                </div>
            </div>
            <form id="contact-form" method="" action="">
            <div class="row body-main-bg justify-content-center">
                <div class="col-4 mb-3">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text">
                                <span class="fa fa-user"></span>
                            </span>                    
                        </div>
                        <input type="text" class="form-control" placeholder="Name">
                    </div>
                </div>
            </div>
            <div class="row body-main-bg justify-content-center">
                <div class="col-4 mb-3">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text">
                                <span class="fa fa-envelope"></span>
                            </span>                    
                        </div>
                        <input type="text" class="form-control" placeholder="Email">
                    </div>
                </div>
            </div>
            <div class="row body-main-bg justify-content-center">
                <div class="col-4 mb-3">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text">
                                <span class="fa fa-ellipsis-v"></span>
                            </span>                    
                        </div>
                        <input type="text" class="form-control" placeholder="Subject">
                    </div>
                </div>
            </div>
            <div class="row body-main-bg justify-content-center">
                <div class="col-4 mb-3">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text">
                                <span class="fa fa-pencil"></span>
                            </span>                    
                        </div>
                        <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="Message"></textarea>
                    </div>
                </div>
            </div>
            <div class="row body-main-bg justify-content-center">
                <div class="col-4 mb-3">
                    <button class="btn btn-primary btn-block" type="submit">Submit</button>
                </div>
            </div>
        </form>
    </div>

Answer №1

To achieve the desired layout, you can switch from using col-4 to col-lg-4 or col-md-4.

The issue lies in the fact that col-4 locks the width across all devices, while col-lg-4 and col-md-4 allow for responsiveness by setting the divs to 100% on larger and medium devices.

For more information about Bootstrap's grid options, visit: https://getbootstrap.com/docs/4.3/layout/grid/

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

Tips for synchronizing JavaScript rendering time with Python requests?

My goal is to retrieve the HTML content of a JavaScript-generated website so that I can extract information using BeautifulSoup. However, when I attempt to request the HTML, the data I receive is from before the page fully loads. Below is the code snippet ...

Personalize your Slick.js

I want to customize the navigation buttons for my Slick.js jQuery slider by replacing the default dots. Since I'm not very experienced with jQuery, I need help writing code that will sync the slider with my custom buttons. ...

Can you explain the significance of "ml" in the context of Bootstrap 4?

Hey there, I'm currently testing out bootstrap4 beta. It seems to have replaced the classes pull-right and pull-left with ml-auto and mr-auto. I assume l stands for left and r stands for right. But what does m represent in this context? Could it be ma ...

Having trouble with my JQuery selection

In the code below, I have assigned an id of "song-pick." $("#archive").append("<div id=\"song-pick\" data-song=\""+song.rank+"\" class=\"box small back"+counter+"\"><span>"+song.title+"</span></div>"); ...

solve the issue of images getting resized in bootstrap 4

I'm facing a challenge with maintaining the size of logo images within their "circle containers" regardless of the browser width. The containers are set at 100px by 100px using the following CSS: .timeline-image::before { content: ""; width: ...

Preventing a draggable item from being dropped into a sortable container when the maximum count has been reached

Check out the following code snippet: <link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.0/jquer ...

Guidelines for utilizing a jQuery array with key-value pairs

Can someone assist me in incorporating a key value array into this jQuery code I found? The current code works well for a single input, but I need to accommodate multiple inputs. jQuery("#btn").on('click', function() { var caretPos = documen ...

Utilizing Bootstrap design elements for a RadioButtonList

I am working on an ASP.NET WebForms application that includes a RadioButtonList which I want to style using Bootstrap's CSS classes. By utilizing the RepeatLayout="Flow" and RepeatDirection="Vertical" settings, the RadioButtonList will be generated i ...

Bootstrap: Easily align elements to the right with the .pull-right class, avoiding the need to manually adjust margins

This is the code snippet I am working with (you can view the fiddle here): <div class='container'> <div class='hero-unit'> <h2>Welcome</h2> <p>Please log in</p> <div i ...

What is the best way to create three buttons for selecting various parameters?

I have a code snippet where I want to assign different parameters to each button when clicked. However, despite my logic, the functionality is not working as expected. Can someone help me with the correct syntax? For example, if I click the "Start (Easy) ...

Error occurred while importing Three.js library: "ERR_ABORTED 404 (Not Found)"

I have been working on following a tutorial on the three.js fundamentals page, but I keep encountering an error when trying to import the module. The error message simply states that the file cannot be found, but I am unable to determine the cause. < ...

Detect Empty Fields as Invalid in Angular 2+ Form Validation

I have been implementing Form Validations in my form using reactive form validation. However, I encountered a challenge when checking a field that is touched and dirty. For example: HTML: <input id="name" class="form-control" formControlName="n ...

I'm currently in the process of creating a Firefox extension and my goal is to accurately count the total number of text boxes on a webpage while excluding any hidden text boxes. Can someone please

As I work on creating a Firefox extension, I am faced with the task of counting the total number of visible text boxes on a webpage while ignoring any hidden ones. Many webpages contain hidden text fields for future use, so my goal is to exclude these fr ...

Utilizing :focus-visible pseudo-class on a custom control

A custom control, made of <div tabIndex="0">....</div>, raises the question: how can we ensure that it works with :focus-visible? Sometimes, creating a complex custom control using <div> and <span>, styled to resemble a na ...

Obtain the PHP function output through asynchronous JavaScript and XML programming

I have a form that collects user input and saves it to the database. After submitting the form, an ajax call is made to the action.php file. e.preventDefault(); $.ajax({ type: "POST", url: "action.php", data: senData, dataType: "JSON", ...

Blending a background image with CSS

I've set a background image for the div, which is also used for responsive design. Check out the demo My goal is to ensure that the image doesn't appear cut off in the responsive view. I'm looking for a CSS solution to blend the image wit ...

What is the best way to organize controls on my website?

My web page controls need to be organized in the specific layout below: Header Left Content - Main Content - Right Content Footer Is there a control available that can assist me with achieving this layout? I prefer not to use a table since it may not b ...

Exploring Every Data Record in jQuery Datatable using PHP

On my PHP page, I have a JQUERY datatable that includes a checkbox. I am trying to retrieve the values of all the checked checkboxes in the datatable using PHP code like this: implode(',', $_POST['accessflag']); The issue I am facing ...

Retrieve the input react component's name

I am new to working with React and I am trying to figure out how to retrieve the name of an input so that I can pass it as a parameter in a method. <div > <FormGroup style={{ width: "400px" }}> ...

Show a notification when utilizing AJAX requests

I consist of two separate files: one written in PHP and the other one in JavaScript and HTML. PHP file : <?php session_start(); //start session $_SESSION['data'] = "The content should be displayed as alert in the JS file"; JS/HTML File: & ...