Home Web Front-end JS Tutorial How to use bootstrap framework? Introduction to the usage of bootstrap framework

How to use bootstrap framework? Introduction to the usage of bootstrap framework

Oct 16, 2018 am 11:43 AM

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)

##1 , some HTML elements and CSS attributes used in Bootstrap need to set the page to the HTML5 document type, that is, add "" at the top of the page


2 . Layout container: Bootstrap needs to wrap a .container or container-fluid (container that occupies the entire viewport) container for the page content and grid system.


3 Grid system: Bootstrap provides a fluid grid system with up to 12 columns. You can quickly create a grid layout through .row representing rows and .col-xs-4, a column representing width.


4 , Bootstrap typography, and link styles set basic global styles.


font-size is set to 14px and line-height is set to 1.428.


The (paragraph) element is also set with a bottom margin equal to 1/2 the line height (i.e. 10px).


Basic style

Typesetting:

1. Title, can be used for .h1 to .h6 categories The text of the associated attribute is given a title style, and the subtitle is marked within the title through the tag or an element with the .small class.

Body text: The .lead class allows paragraphs to be highlighted.

2. Inline text, use The label represents the annotation text, delete, useless, insert, underline, small (the font size of the parent container 85%), emphasis, italics.


3. Text alignment class, text-left, text-center, text-right, text-justify, text-nowrap


4. Text case class, text-lowercase, text-uppercase, text-capitalize


5, abbreviation class, set the title attribute for the element and use the .initialism class to set the font-size become slightly smaller. Example: attr


6. The address is presented in the format for daily use. Just add
at the end of the line to retain the required style.


7. Quote, wrap the HTML element in
to display the quote style. For direct quotes, it is recommended to use the

tag.


8. List, list-unstyled class removes the default list-style A set of elements with styles and left margins (direct children only). The list-inline class sets display: inline-block; And add a small amount of padding to place all elements on the same line. The dl-horizontal class arranges the phrases and their descriptions within
in one line.


Code:
## tag wraps inline style code snippet


Label marks content entered by the user through the keyboard


 Display code block. The pre-scrollable class can be used to set up to 350px with vertical scrollbar. </p>
<p><br><var> Label tag variable</p>
<p><br><samp> Tag tag content output by the program. </p>
<p><br></p>Table: <p><strong></strong><br>.table class specifies the basic style, </p>
<p><br>.table-striped striped style, </p>
<p><br>.table-bordered class has border style, </p>
<p><br>.table-hover class has mouse hover style, </p>
<p><br>.table-condensed Class compact style. </p>
<p><br>Status class (row or cell setting color): active, success, info, warning, info. </p>
<p><br>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.
</p>
<p><strong><br></strong></p>Form: <p><strong></strong><br>1. Basic example: </p>
<p> All settings are .form-control Classes <input>, <textarea> and
<select> elements will have their width attribute set to width: 100%; by default. </p>
<p><br>Wrap the label element and the previously mentioned controls in
The best arrangement can be obtained in .form-group. </p>
<p><br>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. </p>
<p><br>form-group, input-group, control-group, </p>
<p><br>2. Inline form: </p>
<p><form> 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). </p>
<p></p>
<p>The width of the radio/multi-select box control in the inline form is set to width: auto; <br></p>
<p>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. <br></p>
<p>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 <br></p>
<p>4, multi-select and radio button
: .radio, .radio-inline, .checkbox, .checkbox-inline. <br></p>
<p>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 <p> element. <br></p>
<p>6. Control status <br></p>
<p>.disabled class disables controls. When disabled is set to <fieldset>, all included controls are disabled. <br></p>
<p>a tags are not affected by this. The <br></p>
<p>readonly attribute can prevent users from entering the <br></p>
<p>.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. <br></p>
<p>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. </p>
<p>7. Control size<br></p>
<p>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<br></p>
<p>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. <br></p>
<p>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. <br></p>
<p>8. Auxiliary text: help-block class, "block" level auxiliary text for form controls. <br></p>
<p><strong>Buttons: </strong></p>
<p>1. Basic style, btn, btn-default, btn-primary, btn-success, btn-info, btn-warning, btn-danger, active <br></p>
<p>2, display form, btn-link, btn-block, close <br></p>
<p>3, size style, .btn-lg, .btn- sm,.btn-xs. <br></p>
<p>The button class can be applied through the <a>, <button> or <input> elements, but it is recommended to use the <button> element to obtain matching rendering on each browser. Effect. <br></p>
<p><strong>Image: </strong>Image shape, img-rounded, img-circle, img-thumbnail, IE8 does not support the rounded corner attribute in CSS3. <br></p>
<p><strong>Auxiliary: </strong>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
<strong><br></strong></p>
<p><strong>Component style</strong> <br></p>
<p><strong>Icon: </strong> <br></p>
<p>200 A font icon from Glyphicon Halflings. The <br></p>
<p> icon class can only be applied to empty elements and cannot be used in conjunction with other components. <br></p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class='brush:php;toolbar:false;'><span class="glyphicon glyphicon-search"></span>
Copy after login

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

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
JavaScript Engines: Comparing Implementations JavaScript Engines: Comparing Implementations Apr 13, 2025 am 12:05 AM

Different JavaScript engines have different effects when parsing and executing JavaScript code, because the implementation principles and optimization strategies of each engine differ. 1. Lexical analysis: convert source code into lexical unit. 2. Grammar analysis: Generate an abstract syntax tree. 3. Optimization and compilation: Generate machine code through the JIT compiler. 4. Execute: Run the machine code. V8 engine optimizes through instant compilation and hidden class, SpiderMonkey uses a type inference system, resulting in different performance performance on the same code.

Python vs. JavaScript: The Learning Curve and Ease of Use Python vs. JavaScript: The Learning Curve and Ease of Use Apr 16, 2025 am 12:12 AM

Python is more suitable for beginners, with a smooth learning curve and concise syntax; JavaScript is suitable for front-end development, with a steep learning curve and flexible syntax. 1. Python syntax is intuitive and suitable for data science and back-end development. 2. JavaScript is flexible and widely used in front-end and server-side programming.

From C/C   to JavaScript: How It All Works From C/C to JavaScript: How It All Works Apr 14, 2025 am 12:05 AM

The shift from C/C to JavaScript requires adapting to dynamic typing, garbage collection and asynchronous programming. 1) C/C is a statically typed language that requires manual memory management, while JavaScript is dynamically typed and garbage collection is automatically processed. 2) C/C needs to be compiled into machine code, while JavaScript is an interpreted language. 3) JavaScript introduces concepts such as closures, prototype chains and Promise, which enhances flexibility and asynchronous programming capabilities.

JavaScript and the Web: Core Functionality and Use Cases JavaScript and the Web: Core Functionality and Use Cases Apr 18, 2025 am 12:19 AM

The main uses of JavaScript in web development include client interaction, form verification and asynchronous communication. 1) Dynamic content update and user interaction through DOM operations; 2) Client verification is carried out before the user submits data to improve the user experience; 3) Refreshless communication with the server is achieved through AJAX technology.

JavaScript in Action: Real-World Examples and Projects JavaScript in Action: Real-World Examples and Projects Apr 19, 2025 am 12:13 AM

JavaScript's application in the real world includes front-end and back-end development. 1) Display front-end applications by building a TODO list application, involving DOM operations and event processing. 2) Build RESTfulAPI through Node.js and Express to demonstrate back-end applications.

Understanding the JavaScript Engine: Implementation Details Understanding the JavaScript Engine: Implementation Details Apr 17, 2025 am 12:05 AM

Understanding how JavaScript engine works internally is important to developers because it helps write more efficient code and understand performance bottlenecks and optimization strategies. 1) The engine's workflow includes three stages: parsing, compiling and execution; 2) During the execution process, the engine will perform dynamic optimization, such as inline cache and hidden classes; 3) Best practices include avoiding global variables, optimizing loops, using const and lets, and avoiding excessive use of closures.

Python vs. JavaScript: Community, Libraries, and Resources Python vs. JavaScript: Community, Libraries, and Resources Apr 15, 2025 am 12:16 AM

Python and JavaScript have their own advantages and disadvantages in terms of community, libraries and resources. 1) The Python community is friendly and suitable for beginners, but the front-end development resources are not as rich as JavaScript. 2) Python is powerful in data science and machine learning libraries, while JavaScript is better in front-end development libraries and frameworks. 3) Both have rich learning resources, but Python is suitable for starting with official documents, while JavaScript is better with MDNWebDocs. The choice should be based on project needs and personal interests.

Python vs. JavaScript: Development Environments and Tools Python vs. JavaScript: Development Environments and Tools Apr 26, 2025 am 12:09 AM

Both Python and JavaScript's choices in development environments are important. 1) Python's development environment includes PyCharm, JupyterNotebook and Anaconda, which are suitable for data science and rapid prototyping. 2) The development environment of JavaScript includes Node.js, VSCode and Webpack, which are suitable for front-end and back-end development. Choosing the right tools according to project needs can improve development efficiency and project success rate.

See all articles