Bootstrap with CSS
- Bootstrap - Responsive utilities
- Bootstrap - Helper Classes
- Bootstrap - Images
- Bootstrap - Buttons
- Bootstrap - Forms
- Bootstrap - Tables
- Bootstrap - Code
- Bootstrap - Typography
- Bootstrap - CSS Overview
- Bootstrap - Grid System
Bootstrap Layout Components
- Bootstrap - Wells
- Bootstrap - Panels
- Bootstrap - List Group
- Bootstrap - Media Object
- Bootstrap - Progress Bars
- Bootstrap - Alerts
- Bootstrap - Thumbnails
- Bootstrap - Page Header
- Bootstrap - Jumbotron
- Bootstrap - Badges
- Bootstrap - Labels
- Bootstrap - Pagination
- Bootstrap - Breadcrumb
- Bootstrap - Navbar
- Bootstrap - Navigation Elements
- Bootstrap - Input Groups
- Bootstrap - Button Dropdowns
- Bootstrap - Button Groups
- Bootstrap - Dropdowns
- Bootstrap - Glyphicons
Bootstrap Plugins
- Bootstrap - Affix Plugin
- Bootstrap - Carousel Plugin
- Bootstrap - Collapse Plugin
- Bootstrap - Button Plugin
- Bootstrap - Alert Plugin
- Bootstrap - Popover Plugin
- Bootstrap - Tooltip Plugin
- Bootstrap - Tab Plugin
- Bootstrap - Scrollspy Plugin
- Bootstrap - Dropdown Plugin
- Bootstrap - Modal Plugin
- Bootstrap - Transition Plugin
- Bootstrap - Plugins Overview
Bootstrap Demos
- Bootstrap - featured Demo
- Bootstrap - Icons Demo
- Bootstrap - Social Icons Demo
- Bootstrap - Calendar Demo
- Bootstrap - Map Demo
- Bootstrap - Caption Demo
- Bootstrap - Tabbed slider Demo
- Bootstrap - Ajax Demo
- Bootstrap - Admin Interface Demo
- Bootstrap - Alert Demo
- Bootstrap - Time line Demo
- Bootstrap - Slider Demo
- Bootstrap - Material Design Demo
- Bootstrap - Blog Demo
- Bootstrap - Navigation Demo
- Bootstrap - Responsive Demo
- Bootstrap - Images Demo
- Bootstrap - Buttons Demo
- Bootstrap - Form Demo
- Bootstrap - Table Demo
- Bootstrap - Grid Demo
Bootstrap Useful Resources
- Bootstrap - Discussion
- Bootstrap - Useful Resources
- Bootstrap - Quick Guide
- Bootstrap - Questions and Answers
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Bootstrap - Input Groups
This chapter explains about one more feature Bootstrap supports, the Input Groups. Input groups are extended
. Using input groups you can easily prepend and append text or buttons to the text-based inputs.By adding prepended and appended content to an input field, you can add common elements to the user’s input. For example, you can add the dollar symbol, the @ for a Twitter username, or anything else that might be common for your apppcation interface.
To prepend or append elements to a .form-control−
Wrap it in a <span> with class .input-group
As a next step, within that same <span> , place your extra content inside a <span> with class .input-group-addon.
Now place this <span> either before or after the <input> element.
For cross browser compatibipty, avoid using <select> elements here as they cannot be fully styled in WebKit browsers. Also do not apply input group classes directly to form groups. An input group is an isolated component.
Basic Input Group
The following example demonstrates basic input group −
<span style = "padding: 100px 100px 10px;"> <form class = "bs-example bs-example-form" role = "form"> <span class = "input-group"> <span class = "input-group-addon">@</span> <input type = "text" class = "form-control" placeholder = "twitterhandle"> </span> <br> <span class = "input-group"> <input type = "text" class = "form-control"> <span class = "input-group-addon">.00</span> </span> <br> <span class = "input-group"> <span class = "input-group-addon">$</span> <input type = "text" class =" form-control"> <span class = "input-group-addon">.00</span> </span> </form> </span>
Input Group Sizing
You can change the size of the input groups, by adding the relative form sizing classes pke .input-group-lg, input-group-sm, input-group-xs to the .input-group itself. The contents within will automatically resize.
Following examples demonstrates this −
<span style = "padding: 100px 100px 10px;"> <form class = "bs-example bs-example-form" role = "form"> <span class = "input-group input-group-lg"> <span class = "input-group-addon">@</span> <input type = "text" class = "form-control" placeholder = "Twitterhandle"> </span> <br> <span class = "input-group"> <span class = "input-group-addon">@</span> <input type = "text" class = "form-control" placeholder = "Twitterhandle"> </span> <br> <span class = "input-group input-group-sm"> <span class = "input-group-addon">@</span> <input type = "text" class = "form-control" placeholder = "Twitterhandle"> </span> </form> </span>
Checkboxes and Radio Addons
You can preappend or append radio buttons and checkboxes instead of text as demonstrated in the following example −
<span style = "padding: 100px 100px 10px;"> <form class = "bs-example bs-example-form" role = "form"> <span class = "row"> <span class = "col-lg-6"> <span class = "input-group"> <span class = "input-group-addon"> <input type = "checkbox"> </span> <input type = "text" class = "form-control"> </span><!-- /input-group --> </span><!-- /.col-lg-6 --><br> <span class = "col-lg-6"> <span class = "input-group"> <span class = "input-group-addon"> <input type = "radio"> </span> <input type = "text" class = "form-control"> </span><!-- /input-group --> </span><!-- /.col-lg-6 --> </span><!-- /.row --> </form> </span>
Button Addons
You can even preappend or append buttons in input groups. Instead of .input-group-addon class, you ll need to use class .input-group-btn to wrap the buttons. This is required due to the default browser styles that cannot be overridden. Following examples demonstrates this −
<span style = "padding: 100px 100px 10px;"> <form class = "bs-example bs-example-form" role = "form"> <span class = "row"> <span class = "col-lg-6"> <span class = "input-group"> <span class = "input-group-btn"> <button class = "btn btn-default" type = "button"> Go! </button> </span> <input type = "text" class = "form-control"> </span><!-- /input-group --> </span><!-- /.col-lg-6 --><br> <span class = "col-lg-6"> <span class = "input-group"> <input type = "text" class = "form-control"> <span class = "input-group-btn"> <button class = "btn btn-default" type = "button"> Go! </button> </span> </span><!-- /input-group --> </span><!-- /.col-lg-6 --> </span><!-- /.row --> </form> </span>
Buttons with Dropdowns
Adding buttons with dropdown menus in input groups can be done by simply wrapping the button and dropdown menu in a .input-group-btn class as demonstrated in the following example −
<span style = "padding: 100px 100px 10px;"> <form class = "bs-example bs-example-form" role = "form"> <span class = "row"> <span class = "col-lg-6"> <span class = "input-group"> <span class = "input-group-btn"> <button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown"> DropdownMenu <span class = "caret"></span> </button> <ul class = "dropdown-menu"> <p><a href = "#">Action</a></p> <p><a href = "#">Another action</a></p> <p><a href = "#">Something else here</a></p> <p class = "spanider"></p> <p><a href = "#">Separated pnk</a></p> </ul> </span><!-- /btn-group --> <input type = "text" class = "form-control"> </span><!-- /input-group --> </span><!-- /.col-lg-6 --><br> <span class = "col-lg-6"> <span class = "input-group"> <input type = "text" class = "form-control"> <span class = "input-group-btn"> <button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown"> DropdownMenu <span class = "caret"></span> </button> <ul class = "dropdown-menu pull-right"> <p><a href = "#">Action</a></p> <p><a href = "#">Another action</a></p> <p><a href = "#">Something else here</a></p> <p class = "spanider"></p> <p><a href = "#">Separated pnk</a></p> </ul> </span><!-- /btn-group --> </span><!-- /input-group --> </span><!-- /.col-lg-6 --> </span><!-- /.row --> </form> </span>
Segmented Buttons
To segment button dropdowns in input groups, use the same general style as the dropdown button, but add a primary action along with the dropdown as can be seen in the following example −
<span style = "padding: 100px 100px 10px;"> <form class = "bs-example bs-example-form" role = "form"> <span class = "row"> <span class = "col-lg-6"> <span class = "input-group"> <span class = "input-group-btn"> <button type = "button" class = "btn btn-default" tabindex = "-1">Dropdown Menu</button> <button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown" tabindex = "-1"> <span class = "caret"></span> <span class = "sr-only">Toggle Dropdown</span> </button> <ul class = "dropdown-menu"> <p><a href = "#">Action</a></p> <p><a href ="#">Another action</a></p> <p><a href = "#">Something else here</a></p> <p class = "spanider"></p> <p><a href = "#">Separated pnk</a></p> </ul> </span><!-- /btn-group --> <input type = "text" class = "form-control"> </span><!-- /input-group --> </span><!-- /.col-lg-6 --><br> <span class = "col-lg-6"> <span class = "input-group"> <input type = "text" class = "form-control"> <span class = "input-group-btn"> <button type = "button" class = "btn btn-default" tabindex = "-1"> Dropdown Menu </button> <button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown" tabindex = "-1"> <span class = "caret"></span> <span class = "sr-only">Toggle Dropdown</span> </button> <ul class = "dropdown-menu pull-right"> <p><a href = "#">Action</a></p> <p><a href = "#">Another action</a></p> <p><a href = "#">Something else here</a></p> <p class = "spanider"></p> <p><a href = "#">Separated pnk</a></p> </ul> </span><!-- /btn-group --> </span><!-- /input-group --> </span><!-- /.col-lg-6 --> </span><!-- /.row --> </form> </span>Advertisements