Home >Web Front-end >JS Tutorial >How to use bootstrap framework? Introduction to the usage of bootstrap framework
Bootstrap is one of the most popular front-end frameworks from Twitter. The Bootstrap framework is based on HTML, CSS, and javascript. It is simple and flexible, making Web development faster, but many friends don’t know How to use the bootstrap framework, the following article will introduce to you how to use the bootstrap framework.
Without further ado, let’s go straight to the text~ (Free course recommendation: bootstrap tutorial)
Basic style
Typesetting:
Body text: The .lead class allows paragraphs to be highlighted.
Code:
##ffbe95d20f3893062224282accb13e8f tag wraps inline style code snippet
5e4e803d53d659f332070b5d4aa430db Label marks content entered by the user through the keyboard
e03b848252eb9375d56be284e690e873 Display code block. The pre-scrollable class can be used to set up to 350px with vertical scrollbar.
b7f90f73cad438258bf67e62f79b2113 Label tag variable
162cd570ab1483e383d78dcb7f452f7c Tag tag content output by the program.
.table class specifies the basic style,
.table-striped striped style,
.table-bordered class has border style,
.table-hover class has mouse hover style,
.table-condensed Class compact style.
Status class (row or cell setting color): active, success, info, warning, info.
Wrap any .table element in a .table-responsive element to create a responsive table, which will scroll horizontally on small screen devices (less than 768px). The horizontal scrollbar disappears when the screen is larger than 768px width.
1. Basic example:
All settings are .form-control Classes d5fd7aea971a85678ba271703566ebfd, 4750256ae76b6b9d804861d8f69e79d3 and 221f08282418e2996498697df914ce4e elements will have their width attribute set to width: 100%; by default.
Wrap the label element and the previously mentioned controls in
The best arrangement can be obtained in .form-group.
Do not mix the form group and the input box group directly. It is recommended to nest the input box group into the form group.
form-group, input-group, control-group,
2. Inline form:
ff9c23ada1bcecdd1a0fb5d5a0f18437 element is added.form The -inline class causes its content to be left-aligned and behave as an inline-block level control. Only applies when the viewport is at least 768px wide (any smaller viewport width will cause the form to collapse).
The width of the radio/multi-select box control in the inline form is set to width: auto;
If you do not set the label label for each input control, the screen reader will not be able to correctly Identify. For these inline forms, you can hide it by setting the .sr-only class for the label.
3. Horizontally arranged forms
: Change the behavior of .form-group by adding the .form-horizontal class to the form so that it behaves like a row in the grid system
4, multi-select and radio button
: .radio, .radio-inline, .checkbox, .checkbox-inline.
5. Static controls
: In a horizontally laid out form, if you need to place a line of plain text and the label element on the same line, just add the .form-control-static class to the e388a4556c0f65e1904146cc1a846bee element.
6. Control status
.disabled class disables controls. When disabled is set to 2b5469ab79cf842344327415c3b3bb95, all included controls are disabled.
a tags are not affected by this. The
readonly attribute can prevent users from entering the
.has-warning, .has-error or .has-success class to the parent element of these controls. Any .control-label, .form-control, and .help-block elements contained within this element will accept the styles for these validation states.
You can also add additional icons to the input box for the verification status (note that it depends on the label tag). Just set the corresponding .has-feedback class and add the correct icon.
7. Control size
The height can be set for the control through .input-lg .input-sm similar classes, and the control can be set through .col-lg-* similar classes Set width
Quickly set the size for label elements and form controls wrapped in .form-horizontal by adding the .form-group-lg or .form-group-sm class.
You can easily set the width of the input box or any of its parent elements by wrapping it with a column in the grid system.
8. Auxiliary text: help-block class, "block" level auxiliary text for form controls.
Buttons:
1. Basic style, btn, btn-default, btn-primary, btn-success, btn-info, btn-warning, btn-danger, active
2, display form, btn-link, btn-block, close
3, size style, .btn-lg, .btn- sm,.btn-xs.
The button class can be applied through the 3499910bf9dac5ae3c52d5ede7383485, bb9345e55eb71822850ff156dfde57c8 or d5fd7aea971a85678ba271703566ebfd elements, but it is recommended to use the bb9345e55eb71822850ff156dfde57c8 element to obtain matching rendering on each browser. Effect.
Image: Image shape, img-rounded, img-circle, img-thumbnail, IE8 does not support the rounded corner attribute in CSS3.
Auxiliary: text-muted, text-primary, text-success, text-info, text-warning, text-danger
, bg-primary, bg-success, bg-info, bg-warning, bg-danger, triangle symbol, caret
, float
, centered
Component style
Icon:
200 A font icon from Glyphicon Halflings. The
icon class can only be applied to empty elements and cannot be used in conjunction with other components.
<span class="glyphicon glyphicon-search"></span>
Menu:
Wrap the drop-down menu trigger and drop-down menu in .dropdown
Menu alignment: By default, dropdown menus are automatically positioned at 100% width along the top and left edges of the parent element. Adding the .dropdown-menu-right class to .dropdown-menu allows the menu to be right-aligned
Menu grouping: dropdown-header table description items, .disabled table disabled items
Pop up: The .dropup class can make the triggered drop-down menu open upwards
Button group
:
Button group.btn-group, specify the button size in the group through .btn-group-*.
Button bar.btn-toolbar
Buttons are stacked vertically to display btn-group-vertical
Button groups aligned on both ends btn-group-justified
Navigation:
Tabs.nav-tabs class depends on .nav base class.
Capsule tab page .nav-pills class, add .nav-stacked class to change it to vertical stacking.
The .nav-justified class makes it easy to make tabs or capsules the same width.
navbar navbar-default
For the bb9345e55eb71822850ff156dfde57c8 element that is not included in ff9c23ada1bcecdd1a0fb5d5a0f18437, after adding .navbar-btn, you can make it Center the navigation bar vertically.
Placing the form within .navbar-form can provide good vertical alignment,
.navbar-text
. navbar-link
.navbar-left and .navbar-right utility classes align navigation links, forms, buttons or text.
.navbar-fixed-top class allows the navigation bar to be fixed at the top
.navbar-fixed-bottom class allows the navigation bar to be fixed at the bottom
.navbar-static-top class allows the navigation bar to disappear as the page scrolls down.
.navbar-inverse class can change the appearance of the navigation bar.
breadcrumb Creates a hierarchical navigation structure (breadcrumbs).
Page:
pagination, and use the .disabled class and the .active class for the page number according to the situation.
The .pagination-lg or .pagination-sm classes provide additional sizes to choose from.
pagerSimple page turning to the previous and next pages. And can be marked by previous and next classes.
Label: label label base class, the label can be changed through label-default, label-primary, label-success, label-info, label-warning, label-danger Exterior.
badge, which can display new or unread information items very conspicuously.
Others: Thumbnails
, prompt box
,progress bar
, media objects, etc.
Customized style
BootStrap provides components and jquery plug-ins for customization according to their own needs. Users can also directly modify the Less source code.
The above is the detailed content of How to use bootstrap framework? Introduction to the usage of bootstrap framework. For more information, please follow other related articles on the PHP Chinese website!