Widths for input fields (first name, middle name, and last name) inline in Twitter Bootstrap

I've been grappling with the sizing of inputs in Twitter-Bootstrap for a while now. I have a form that requires client address details. Specifically, I want to align the "Name" section (containing First name, middle name, and last name) in a single row where all three input fields have equal widths compared to the other inputs (using the class="input-xxlarge").

However, when I apply different "input-*" classes (e.g., "input-small") to each input, they either end up being too wide or too narrow.

<div class="control-group">
    <label class="control-label" for="FirstName">Name</label>
    <div class="controls">
        <input class="input-small" id="FirstName" name="FirstName" placeholder="First name" type="text" value="" />
        <input class="input-small" id="MiddleName" name="MiddleName" placeholder="Middle name" type="text" value="" />
        <input class="input-small" id="LastName" name="LastName" placeholder="Last name" type="text" value="" />
    </div>
</div>

http://jsfiddle.net/RXGKN/

Simply setting a percentage width inline does not solve the issue. Has anyone successfully managed to achieve this alignment so that both sides seamlessly fit with the other inputs, including responsiveness?

Is there a method to create a row matching the width of "input-xxlarge" and utilize spanX (such as span4) on each input within a "control-group" > "controls" structure?

Answer №1

<div class="form-group">
  <label class="form-label" for="First_name">First Name</label>
    <div class="input-controls row-fluid">
        <div class="input-field span2 row"><input class="span12" id="First_name" name="First_name" placeholder="First Name" type="text" value="" /></div>
        <div class="input-field span2 row"><input class="span12" id="Middle_name" name="Middle_name" placeholder="Middle Name" type="text" value="" /></div>
        <div class="input-field span2 row"><input class="span12" id="Last_name" name="Last_name" placeholder="Last Name" type="text" value="" /></div>
        <p class="help-text span12 row" style="color: purple;">How can I ensure that these three inputs are the same width as the "Address" input.</p>
    </div>
</div>
<div class="form-group">
  <label class="form-label" for="Street_address">Address</label>
  <div class="input-controls row-fluid">
    <div class="input-field span6 row"><input class="span12" id="Street_address" name="Street_address" placeholder="Street Address" type="text" value="" /></div>
  </div>
</div>

http://jsfiddle.net/baptme/RXGKN/2/

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

Having trouble with the responsive design not functioning properly?

Having trouble with mobile view in my simple HTML Bootstrap code. Everything looks fine in desktop view but not in mobile. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < ...

An issue has occurred due to an illegal mix of collations (greek_general_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) when performing the operation 'like'

Although this topic has been extensively covered, my issue presents a slightly different challenge. I have set the default charset to utf8 in both the connection made to mysqldb in my Python code and my HTML files. conn = pymysql.connect(host='my ...

Outline border for the parent element of the targeted event

How can I add a border outline to the parent div of the selected event.target? // To display our own context menu instead of the default one $(document).on("contextmenu", function(event) { // Skip if the target is a link if ($(event.target).hasClass ...

Google Maps is experiencing issues with navigating the map accurately

This is a code snippet on jfiddle that I need help with: http://jsfiddle.net/w8NRr/ The issue I'm facing is that when I attempt to move the map, it briefly moves and then returns to its original position automatically. Additionally, the map does not ...

Navigational aids contained within buttons

Styling for Tooltip: .mainButtonContainer button:hover:after { background: none repeat scroll 0 0 rgba(255, 255, 255, 0.7); border-color: #093466; border-radius: 5px 5px 5px 5px; border-style: solid; border-width: 7px 2px 2px; bot ...

Enhancing webpage design by dynamically changing borders and headers using JavaScript

I have implemented a fixed positioning for the table headers using the following code: onScroll={() => { document.querySelector('thead').style.transform = `translate(0,${this.scrollRef.scrollTop}px)`; }} However, when I scroll the ta ...

Unable to show the URL for the background image

https://i.sstatic.net/XcdHF.jpg Encountering an issue in displaying the image, I am unsure about the specific subdirectory to navigate from the css folder to the images folder despite my attempts. background: url('images/home1.jpg') top left no ...

What steps do I need to take to create a dropdown menu that has the ability to search through each individual component

Hello everyone, please excuse my lack of experience as I am a beginner in this field. I am trying to figure out how to add a dropdown feature to my search bar so that users can search within the dropdown menu. However, I am facing some challenges with this ...

Is there a way to verticially center text and images across columns using Bootstrap 5?

My text is not aligned properly due to excessive padding, causing it to shift to the top right. I attempted to use Bootstrap to adjust alignment and justification but am still struggling to identify the cause of this issue. Unfortunately, I cannot provide ...

What is the process of adding a bootstrap element to an existing HTML document using JavaScript?

I need help adding a Bootstrap alert with JavaScript code into an already existing HTML file. Here is the code I attempted to use: <script> let field = document.getElementById("someID"); let text = document.write(" <div class="alert alert-da ...

Even with proper definition, the function remains undefined

I'm attempting to call the async function openFormPreview(e) from an onclick event, but I keep getting this error in the console: Uncaught ReferenceError: openFormPreview is not defined Below is the code snippet: async function openFormPreview(ele ...

Create engaging text animation by transitioning from horizontally displayed text to vertically displayed text with the letters standing upright using An

I'm trying to create an animation where an acronym is displayed horizontally in the middle of the screen and then flips vertically. The challenge I'm facing is rotating individual letters once they are vertical so that the text reads from top to ...

Calendar tool in Firefox

While I am aware that similar questions have been asked in the past, none of them have provided me with the answer I am seeking. In my form, users are required to enter a date. It would enhance the user experience if there was a calendar or an alternative ...

What is the best method for achieving a div that is 100% height in relation to the screen while also having a `top

My div element is set with a top='70px' property. However, when the div has content that requires scrolling, it moves down and the end of the scroll is not visible. I tried adding the following properties to the div, but it did not resolve the ...

What jQuery method can be used to target the parent table containing a nested table opposite of the :has() selector?

I am facing an issue with a nested table structure in my HTML code. Below is the representation of the table: <table class="table parent"> <tbody> <tr> <td>TEXTA</td> <td>TEXTB</td> </t ...

Exploring Text Color Verification with CSS in Selenium IDE

I am working on a project and want to ensure that my link is styled properly: <a class="title">My link</a> The CSS code used to style my link is as follows: a.title { color: #CC3333; } How can I confirm that the text "My link" is displayi ...

Creating a sleek appearance for Bootstrap input within the selectize.js component by mimicking the input-sm

I am currently working with a selectize component that appears like this: https://i.sstatic.net/z2aTw.png My objective is to adjust the appearance of the search input to make it smaller by changing its class from the standard bootstrap input to input-sm. ...

Experience the potential of HTML5 by playing dual audio MKV/AVI videos

After conducting some research, it seems that Chrome has the necessary codecs to play MKV videos. However, I have yet to come across any information on how to select audio tracks in MKV and AVI files using Javascript/HTML5. Does anyone have any insight in ...

JavaScript line beneath the navigation

I have implemented a small JavaScript code snippet to add a line under links on my website. Here is the code: $("li").on("click", function() { $("li").removeClass("line"); $(this).addClass("line"); }); .line { border-bottom: 4px solid # ...

Can a custom CSS be linked directly to the angular-cli.json file?

I'm trying to incorporate custom CSS into my angular-cli.json file, but I haven't been able to find a successful method. I attempted to use the following code: "styles": [ "styles.css", "http://site.test/mycss.css" ], However, it does ...