Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 input-append upgrade

I'm upgrading to Bootstrap 3, but I just can't figure out how to upgrade my old input-appends.

I had something like this:

<div class="input-append">   <select>     <option>hi</option>     <option>hi2</option>   </select>   <span class="input-group-addon"></span>   <input type="submit" class="btn" value="valami"> </div> 

Preview: http://bootply.com/75910

In Bootstrap 3, this is the closest I could get

<div class="input-group">   <select class="form-control">     <option>hi</option>     <option>hi2</option>   </select>   <span class="input-group-addon"></span>   <input type="submit" class="form-control btn btn-default" value="valami"> </div> 

Preview: http://bootply.com/75912

If I remove that span it gets perfect, but they are in different lines.

Any idea how to do this properly?

like image 512
kviktor Avatar asked Aug 21 '13 12:08

kviktor


People also ask

What input types does bootstrap support?

Bootstrap Input. Bootstrap supports all the HTML5 input types: text, password, datetime, datetime-local, date, month, time, week, number, email, url, search, tel, and color. Note: Inputs will NOT be fully styled if their type is not properly declared!

How do I create an input group in Bootstrap?

To create an input group, use Bootstrap's .input-group class for the actual input group, then use .input-group-addon on the element that you want to append or prepend to the form control. Note that input groups are designed for textual <input> elements only. Text on Both Sides.

What's new in Bootstrap 3?

Switch from Less to Sass for the source CSS files. Switched from px to rem as the primary CSS unit. Media queries are now in ems instead of pxs. Global font-size increased from 14px to 16px. Bootstrap 3 source code includes the precompiled CSS, JavaScript, and font assets, along with source Less, JavaScript, and documentation.

How to migrate from Bootstrap version 3 to 4?

How to Migrate from Bootstrap Version 3 to 4 1 Video Tutorial 2 Global Changes. Switch from Less to Sass for the source CSS files. Switched from px to rem as the primary CSS unit. ... 3 Bootstrap Source Code. Bootstrap 3 source code includes the precompiled CSS, JavaScript, and font assets, along with source Less, JavaScript, and documentation.


1 Answers

This is documented here and here:

Remove input-prepend and input-append for singular .input-group. The classes have changed for the elements within, and require a bit more markup to use buttons:

  • Use .input-group as the parent class around the input and addon.
  • For text based prepends/appends, use .input-group-addon instead of .addon.
  • For button prepends/appends, use .input-group-btn and place your .btn within that element.

Example:

<div class="container">   <div class="row">     <div class="col-sm-3 col-xs-12 col-lg-3">       <form class="form-search">           <div class="input-group">               <input type="text" class="form-control " placeholder="Text input">               <span class="input-group-btn">                   <button type="submit" class="btn btn-search">Search</button>               </span>           </div>       </form>     </div>   </div> </div> 

EDIT: Working examples from @kviktor and @max4ever:

http://bootply.com/75917

http://bootply.com/78014

like image 156
elyase Avatar answered Sep 28 '22 04:09

elyase