Bootstrap: wider input field

Twitter Bootstrap

Twitter Bootstrap Problem Overview


How can I make the input field wider than the default in Twitter's Bootstrap?

I am trying to create a wider search form in the hero-unit class from the example.

Twitter Bootstrap Solutions


Solution 1 - Twitter Bootstrap

There are various classes for different size inputs

 :class=>"input-mini"

 :class=>"input-small"

 :class=>"input-medium"

 :class=>"input-large"

 :class=>"input-xlarge"

 :class=>"input-xxlarge"

Solution 2 - Twitter Bootstrap

Use the bootstrap built in classes input-large, input-medium, ... : <input type="text" class="input-large search-query">

Or use your own css:

  1. Give the element a unique classname class="search-query input-mysize"
  2. Add this in your css file (not the bootstrap.less or css files):
    .input-mysize { width: 150px }

Solution 3 - Twitter Bootstrap

in bootstrap 3.0 :

> Set heights using classes like .input-lg, and set widths using grid column classes like .col-lg-*.

Example:

<div class="row">
    <div class="col-xs-2">
        <input type="text" class="form-control" placeholder=".col-xs-2">
    </div>
    <div class="col-xs-3">
        <input type="text" class="form-control" placeholder=".col-xs-3">
    </div>
    <div class="col-xs-4">
        <input type="text" class="form-control" placeholder=".col-xs-4">
    </div>
</div>

Source: http://getbootstrap.com/css/#forms-control-sizes

Solution 4 - Twitter Bootstrap

I made a wider input field by using either span4 or span6 as class.

<input type="text" class="span6 input-large search-query">

This way you don't need the additional custom css, mentioned earlier.

Solution 5 - Twitter Bootstrap

There is also a smaller one yet called "input-mini".

Solution 6 - Twitter Bootstrap

I am going to assume you were having the same issue I was. Even though you specify larger sizes for the TextBox and mark it as important, the box would not get larger. That is likely because in your site.css file the MaxWidth is being set to 280px.

Add a style attribute to your input to remove the MaxWidth like this:

<input type="text"  style="max-width:none !important" class="input-medium">

Solution 7 - Twitter Bootstrap

In bootstrap 4, they have designed a bigger input file.

A simple solution to increase the size input file is to use font-size:

Add you style, for example:

input[type="file"] {
  font-size:35px
}

Otherwise, you can make one custom class and add to input control.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionyayuView Question on Stackoverflow
Solution 1 - Twitter Bootstrapuser1449337View Answer on Stackoverflow
Solution 2 - Twitter BootstrapChrisRView Answer on Stackoverflow
Solution 3 - Twitter BootstrapLGamaView Answer on Stackoverflow
Solution 4 - Twitter BootstrapAndraView Answer on Stackoverflow
Solution 5 - Twitter BootstrapPaitoView Answer on Stackoverflow
Solution 6 - Twitter BootstrapBradView Answer on Stackoverflow
Solution 7 - Twitter Bootstrapprash212View Answer on Stackoverflow