Home > Article > Web Front-end > Introducing a feature of Bootstrap input box group
This chapter will explain another feature supported by Bootstrap, input box group. The input box group extends from the form control. Using input box groups, you can easily add text or buttons as prefixes and suffixes to text-based input boxes.
You can add common elements to user input by adding prefix and suffix content to the input field. For example, you could add a dollar sign, or @ before your Twitter username, or other common elements required by the application interface.
The steps to add prefix or suffix elements to .form-control are as follows:
Place the prefix or suffix elements in a
Next, within the same
Place the before or after the element.
To maintain cross-browser compatibility, avoid using
Sometimes, we need to combine a text input box (input group) with a file or small icon for display, which we call addon. That is, by adding text or buttons in front, behind or on both sides of the text input box , the form control can be extended. This article will introduce in detail the Bootstrap input box group
Add additional elements or buttons on either side of the input box. You can also add additional elements on both sides of the input box at the same time
@@example.com$ .00
【Notes】
1. Avoid using elements because WebKit browsers cannot fully draw its styles
2. Avoid using elements because of their
rows
Attributes are not supported in some cases
3. Do not mix form groups or grid column (column) classes directly with input box groups. Instead, the input box group is nested inside the form group or grid-related element
错误示范
@@正确示范
@@
4. You can add multiple ( .input-group-addon
or .input-group-btn
)
@ @ @
5. Does not support adding multiple form controls to a single input box group
@
Add the corresponding size class to .input-group
, and the elements contained within it will automatically adjust their size. There is no need to repeatedly add sizing classes for each element in the input box group. .input-group-lg and .input-group-sm are provided, but the ultra-small style is not provided. Maybe the author thinks it is not needed
@@@
[Multi-select box or radio button]
You can add a multi-select box or radio button as an additional element to the input box group
【Button】
To add a button to the input box group, you need to add an extra layer of nesting, not .input-group -addon
, instead add .input-group-btn
to wrap the button element. Since the .btn button style defines various styles, it is not like checkbox, radio, label, etc. that can be directly placed in the .input-group-addon style. Therefore, in order to avoid conflicts, the author set up a separate .input-group-btn style for the .btn style to replace .input-group-addon as the new addon container
[Button drop-down menu]
It’s natural that if you can support buttons, you can also support button drop-down menus. No additional style support is needed, just in the ordinary Just apply a data-toggle="dropdown" attribute to the .btn button
[Split button drop-down menu]
The above is the detailed content of Introducing a feature of Bootstrap input box group. For more information, please follow other related articles on the PHP Chinese website!