Utilizing the Bootstrap grid system allows for input fields to automatically expand to 100% width once they reach

I am encountering some challenges while attempting to develop a responsive form using bootstrap grids. The issue seems to arise when resizing the browser window, as the grid classes behave unexpectedly by expanding and taking up the entire page width at certain breakpoints.

<div id="custom-wrapper">
    <div class="row">
        <div class="col-lg-12">
            <h1>Create Definitions</h1>
            <div style="#display#" class="error-box alert alert-#alert#">#alertMsg#</div>
        </div>
        <!-- /.col-lg-12 -->
        <div class="row">
            <div class="panel panel-default">
                <div class="panel-body">
                    <div class="row">
                        <div class="col-lg-10">
                            <form class="form-horizontal" id="addDef" action="index.cfm?group=#URL.group#" method="POST">
                                <div class="form-group"> <!--- state select --->
                                    <label for="state" class="col-lg-3 control-label">Assign to State:</label>
                                    <div class="col-lg-7">
                                        <select id="states" name="states" class="form-control">
                                            <cfloop query="state">
                                                <option value="#state.ID#" name="state">#state.StateName#</option>
                                            </cfloop>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group"> <!--- state select --->
                                    <label for="sluglist" class="col-lg-3 control-label">Assign to Question:</label>
                                    <div class="col-lg-7">
                                        <select id="slugList" name="slugs" class="form-control">
                                            <option selected>--- Choose a Slug ---</option>
                                            <cfloop query="questions">
                                                <option value="#questions.ID#" name="state">#questions.slug#</option>
                                            </cfloop>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group" id="xhrHidden" style="display:none"> <!--- question text --->
                                    <label for="term" class="col-lg-3 control-label">Question Text:</label>
                                    <div class="col-lg-7">
                                        <span id="questionText"></span>
                                    </div>
                                </div>
                                <div class="form-group"> <!--- rich text div for definition --->
                                    <label for="term" class="col-lg-3 control-label">Text Entry:</label>
                                    <div class="col-lg-7">
                                        <textarea name="term" id="term"></textarea>
                                        <div>Define a term or phrase on a state by state basis.</div>
                                    </div>
                                </div>
                                <div class="form-group"> <!--- group select --->
                                    <label for="state" class="col-lg-3 control-label">Group: #group.GroupName#</label>
                                    <div class="col-lg-7">
                                        <div>#group.GroupName#</div>
                                    </div>
                                </div>
                                <div class="form-group"> <!--- submit button --->
                                    <label for="submit" class="col-lg-3 control-label"></label>
                                    <div class="col-lg-7">
                                        <input type="submit" class="btn btn-primary" id="submitbutton" value="Create Definition" />
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

It puzzles me why my grid elements suddenly expand at around the halfway point while not adhering to even widths across all elements. I would appreciate it if someone could shed light on this matter and offer guidance on improving grid behavior for more consistent element sizing.

Answer №1

How come my grid system expands halfway through?

This occurs because you've only utilized the .col-lg-* grid classes, which adjust column styling for large screens while leaving them as is on smaller screens.

As a result, block-level elements like <div> will naturally expand to fill their parent's space.

To manage column widths on smaller devices, try incorporating col-md-* and/or col-sm-* classes in addition to .col-lg-*, following this order:

<div class="col-xs-* col-sm-* col-md-* col-lg-*">

For more details, check out this related response:

  • What happens when grid classes apply to devices with smaller breakpoint size

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

Parallax not functioning properly due to CSS before and after elements

I am attempting to use before and after pseudo-elements for a parallax effect on my div element <div id="OurPhilosophy" class="parallax-window" data-parallax="scroll" data-image-src="https://cdn6.bigcommerce.com/s-jhmi7y5v2c/product_images/uploaded_ima ...

Enabling the submit button only when text is entered in the text fields using jQuery

I have a script that automatically submits a form when two textfields are filled using variables from local storage. The script checks if the variables for email and password are not null before submitting. if (localEmail != null && localPwd != null) { ...

Duplicate the canvas onto a new canvas

One of the functions I am using involves copying an old canvas to a new canvas. Here is the code snippet for this functionality: function cloneCanvas(oldCanvas) { //create a new canvas var newCanvas = document.createElement('canvas&a ...

Assigning a value using HTML code causes the input to malfunction

Trying to create a website with the goal of updating the database is proving to be challenging. The issue lies in the fact that some attributes from the database are in HTML format. Whenever I attempt to set an input's value to match the current attri ...

Styling Challenges with CSS/AngularJS Accordion in Footer

I want to create a page layout as shown below: +---------------------------+ | Auto-fill / v scrollable ^| | || | || | v| +---------------------------+ | Fixed [][][] ...

Is the "footer" div automatically nested within the "main" div if they are not nested in the code?

Within my code structure, I currently have the following: <html> <head> ... </head> <body> <div id="body"> <div id="main"> ... </div> <div id="foot ...

What is the best way to create a mirrored effect for either a card or text using CSS

Can anyone assist me with this CSS issue? When I hover over to view the movie details, the entire word flips along with it. Is there a way to make only the word flip initially, and then have it return to normal when hovered? The HTML code is included belo ...

Tips for creating an adjustable background image size

Is it possible to adjust the height of a section to match the background using CSS? Currently, the height is determined by the content within the section. CSS: .content-block { background-size: cover; background-position: center center; } HTML: &l ...

Display issue with positioning user name in navbar on Internet Explorer

The user name appears correctly in the navbar on Firefox and Chrome, but in IE it drops down due to a break tag issue. Is there a way to resolve this in IE so that it displays like in Firefox and Chrome? body { padding-top: 102px; background-colo ...

Choosing an element that does not have a particular string in its colon attribute name

In my code, I have multiple elements structured like this: <g transform="matrix"> <image xlink:href="data:image/png" width="48"> </g> <g transform="matrix"> <image xlink:href="specific" width="48"> </g> <g tran ...

Ways to verify an iCheck located on the following page

Here is the code snippet I am currently working with: $("#add-new-size-grp").click( function (event) { event.preventDefault(); $.ajax({ type: "get", url:"ajax-get-sizes.php", success: function(result){ $("#sizeg ...

What is the best way to obtain a direct file link from a server URL using JavaScript?

After acquiring a file located at /home/johndoe/index.html, I am utilizing a tool like XAMPP to host, with the folder /home being hosted on localhost. The variables in play are as follows: $server_addr = "localhost"; $server_root = "/home"; $file_dir = " ...

Unexpected resizing of DIV element in Chrome

Working on my new PHP website, I encountered a strange issue recently. I have a file for the top navbar that is included on every page and it was functioning perfectly fine. However, while creating a register form, I noticed something odd happening. When r ...

Elevate the expanded card above the others on hover instead of displacing them downward

I'm working on a grid of cards where hovering over one card expands the bottom section to reveal more content. The issue is, when it expands, it pushes all other cards down. What I actually want is for it to overlay on top of the card below it. Here ...

Require help with personalizing a jQuery horizontal menu

I recently downloaded this amazing menu for my first website project By clicking the download source link, you can access the code Now, I need your kind help with two issues: Issue 1: The menu seems to be getting hidden under other elements on the page ...

Bug in ZURB Foundation Topbar causes incorrect highlighting of links on mobile when clicked

While utilizing the ZURB Foundation Topbar, I have encountered a bug that I find frustrating. When navigating the 2nd level drop downs and clicking on a link (li elements), the active highlight flickers to one of the elements above before taking you to the ...

What is the best way to decrease the size of a SELECT element in Bootstrap 3?

Is there a way to combine form-control and input-mini classes in order to create a SELECT element with a width of around 60px and a height of approximately 20px? <select id="RoleSelect" class="form-control input-mini { width: 60px; }" runat="server"> ...

Creating a radial gradient texture using CSS

I'm encountering an issue with my radial gradient and texture combination. Here is the code snippet I am using: background-image: url('../img/texture.png'); /* fallback */ background: -moz-radial-gradient(rgba(253,253,253,0.1) 0%, rgba(2 ...

Vuetify: how to disable the color transition for v-icon

My menu includes both icon and text items, with hover color styled using the following CSS: .v-list-item:hover { background: #0091DA; } .v-list-item:hover .v-list-item__title, .v-list-item:hover .v-icon { color: white; } The problem is that the ...

With Vue's new implementation of adding data attributes to the "*" selector, how can I adapt to this change?

Typically, I reset all margins/paddings by including the following code snippet at the beginning of my CSS: *, body { margin: 0; padding: 0; } This method usually works fine since it is overridden by subsequent selectors. However, Vue appends data att ...