Bootstrap Primer (11) Component 5: Input frame Group

Source: Internet
Author: User

Bootstrap (11) Component 5: Input Box Group 1. Add the first input box 2. Add an additional element 3. Provide the user with an identity of 4. Change the size of the input box 5. Add multi-select/Radio box 6 for extra. Combined with buttons 7. Combined with a drop-down menu First introduce the local CSS file and JS file (Note: 1.bootstrap is required for jquery support. 2. Need to add in <body>)
  <href= "Css/bootstrap.min.css"  rel= "stylesheet"> 
<src= "jquery-3.1.0.min.js"  type= "Text/javascript"> </script><src= "Bootstrap.min.js" type = "Text/javascript" ></ Script >
By using the text input box <input>The extension of the form control can be achieved by adding text or buttons to the front, back, or both sides. For .input-groupGive .input-group-addonclass that can give .form-controlAdd additional elements to the front or back of the Only text input boxes are supported <input>Please avoid using this <select>Element, because the WebKit browser cannot fully draw its style. Avoid using <textarea>Elements, because of their rowsProperties are not supported in some cases. The ToolTips and pop-up boxes in the input box group need to be specifically set to .input-groupYou must set the element that contains the ToolTip (tooltip) or PopOver (popover) container: ‘body‘parameter to avoid unintended side effects (for example, when a ToolTip or popover is activated, the current element may become wider or/and become lost its rounded corners). Action: First create a div (class= "input-group") for the input box group from the DIV
     <class= "container">            <class = "Input-group" >                 ...             </ Div >        </ Div >
1. Add the first input box to see the effect first
<Divclass= "Container">            <Divclass= "Input-group">                <inputtype= ' text 'class= "Form-control"placeholder= "username">            </Div>        </Div>
The effect is:

2. Add extra element is a <span> tag
<Divclass= "Container">            <Divclass= "Input-group">                <spanclass= "Input-group-addon">@</span>                <inputtype= ' text 'class= "Form-control"placeholder= "username">            </Div>               </Div>
Effect: 3. Provide the user with a logo such as money
<Divclass= "Input-group">                <spanclass= "Input-group-addon">$</span>                <inputtype= ' text 'class= "Form-control">                <spanclass= "Input-group-addon">.00</span>            </Div>
Effect

4. Change the size of the input box also has LG,SM size
<Divclass= "Input-group input-group-lg">                <inputtype= ' text 'class= "Form-control">            </Div>            <Divclass= "Input-group">                <inputtype= ' text 'class= "Form-control">            </Div>            <Divclass= "Input-group input-group-sm">                <inputtype= ' text 'class= "Form-control">            </Div>
effect, size distinctly differentiated

5. Add multi-select/Radio box (note using the grid, here is col-lg-6, let go, in the browser will take up half of the screen, detailed can see the introduction (ii) GRID) (type= ' checkbox '/type= ' Radio ' in the <input>)
<Divclass= "Row">                <Divclass= "Col-lg-6">                    <Divclass= "Input-group">                        <spanclass= ' Input-group-addon '>                            <inputtype= ' checkbox '>                        </span>                        <inputtype= ' text 'class= "Form-control">                    </Div>                    <Divclass= "Input-group">                        <spanclass= ' Input-group-addon '>                            <inputtype= ' Radio '>                        </span>                        <inputtype= ' text 'class= "Form-control">                    </Div>             <Div>
Effect, class according to actual needs, add different number, of course, can be placed before and after

6. Combined with the button only need to use <button> to replace <input&gt, note,<span> in the class= ' input-group-btn ' to replace class= ' Input-group-addon ', otherwise the button will be larger than the input box, not beautiful
<Divclass= "Input-group">                        <spanclass= ' input-group-btn '>                            <Buttonclass= "Btn Btn-default"type= ' button '>Asd</Button>                        </span>                        <inputtype= ' text 'class= "Form-control">                    </Div>
Effect

7. Combine with drop-down menu (remember to introduce JS file)
<Divclass= "Input-group">                        <Divclass= ' input-group-btn '>                            <Buttonclass= "btn btn-default dropdown-toggle"type= ' button 'Data-toggle= ' dropdown '>ZXC<spanclass= ' caret '></span>                            </Button>                             <ulclass= "Dropdown-menu"role= ' Menu '>                                <Li><ahref="#">1</a></Li>                                <Li><ahref="#">2</a></Li>                                <Li><ahref="#">3</a></Li>                            </ul>                             </Div>                        <inputtype= ' text 'class= ' Form-control '>                    </Div>
Effect:

Depending on your needs, you can also change to a split drop-down menu.

Bootstrap Primer (11) Component 5: Input frame Group

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.