Home Web Front-end JS Tutorial Analysis on how to use form and navbar in Bootstrap

Analysis on how to use form and navbar in Bootstrap

Jun 25, 2018 am 10:55 AM
bootstrap form Navigation bar form

This article mainly explains in detail how to use form and navbar in Bootstrap. Interested friends can refer to it

1. Form(Form)

Source code file:
_form.scss
mixins/_form.scss

1. According to the hierarchical structure: form-group -> form-control/input-group/form-static-control -> Various tags
2. Containers such as Form-group/form-control/input-group/form-static-control are divided into two types Display mode: block, inline-block. Table-cell is used to implement the input-group level.

.input-group {
  display: inline-table;
  vertical-align: middle;
  .input-group-addon,
  .input-group-btn,
  .form-control {
  width: auto;
  }
}
Copy after login

3. Input-group-addon: If the web page text icon is inserted into the class, it will be displaced by one pixel.


Solution: glyphicon cannot be combined with other styles, but is nested internally. Yes, because glyphicon has a 1-pixel setting for top:

.glyphicon {
 position: relative;
 top: 1px;
 display: inline-block;
 font-family: 'Glyphicons Halflings';
 font-style: normal;
 font-weight: normal;
 line-height: 1;
 -webkit-font-smoothing: antialiased;
 -moz-osx-font-smoothing: grayscale;
}
Copy after login

## 2. Navigation bar (navbar)

Source code file:


_navbar.scss

1. Mainly divide the internal areas, such as: head, other areas; and the position of the navigation bar Positioning

2. Folder implementation (removed in 4.0), which is the navbar-collapse class. Instead of collapse, a hidden layer pops up on the button
2.1. Navbar-collapse: When it is greater than the breakpoint, it will Forced display (because collapse is hidden by default)
3. Content supports nav, brand, form, toggler
4. Navbar-toggler (removed in 4.0): set to display when the screen is smaller than the breakpoint value (768) , and in 4.0, collapse is used directly to display this button. There is no screen size limit. The application of navbar-toggle must also be used in combination with collapse.
5. Navbar-static-top: Just add zIndex and remove the rounded corners. Border width, etc.
6. Navbar-fixed-top/bottom: They are positioned above and below, with floating effects
7. Navbar-brand: Brand, you can put the web page name, company logo and other content
8. Navbar -toggle: The clicked image used for shrinking. It will be displayed when it is less than the breakpoint. If it is greater than this value, it will be hidden (and the toggle display is right-floating and used as a relatively positioned element):

.navbar-toggle {
 position: relative;
 float: right;
 margin-right: $navbar-padding-horizontal;
 padding: 9px 10px;
 @include navbar-vertical-align(34px);
 background-color: transparent;
 background-image: none; // Reset unusual Firefox-on-Android default style; see https://github.com/necolas/normalize.css/issues/214
 border: 1px solid transparent;
 border-radius: $border-radius-base;

 // We remove the `outline` here, but later compensate by attaching `:hover`
 // styles to `:focus`.
 &:focus {
 outline: 0;
 }

 // Bars
 .icon-bar {
 display: block;
 width: 22px;
 height: 2px;
 border-radius: 1px;
 }
 .icon-bar + .icon-bar {
 margin-top: 4px;
 }

 @media (min-width: $grid-float-breakpoint) {
 display: none;
 }
}
Copy after login

9. Navbar-nav: Some compatibility settings have been made based on the original nav. The main ones are the style adjustment under breakpoint-max and the style adjustment under breakpointg. Should they be removed? Default background color, shadow and other contents

10. Navbar-form: Mainly adjust all forms to be inline elements
11. Navbar-text, navbar-btn: All are compatible based on the default Settings
12. Navbar provides two themes: default and inverse. Each theme has corresponding style compatibility processing for its respective components.
13. The navigation bar itself does not have many styles, and it only provides toggle. , brand content, mainly provides two themes, and a combination of the four components dropdown, collapse, form, and nav.

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to use responsive tools using bootstrap

How to implement Table search box and query in Bootstrap

The above is the detailed content of Analysis on how to use form and navbar in Bootstrap. For more information, please follow other related articles on the PHP Chinese website!

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 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)

How to use bootstrap in vue How to use bootstrap in vue Apr 07, 2025 pm 11:33 PM

Using Bootstrap in Vue.js is divided into five steps: Install Bootstrap. Import Bootstrap in main.js. Use the Bootstrap component directly in the template. Optional: Custom style. Optional: Use plug-ins.

How to get the bootstrap search bar How to get the bootstrap search bar Apr 07, 2025 pm 03:33 PM

How to use Bootstrap to get the value of the search bar: Determines the ID or name of the search bar. Use JavaScript to get DOM elements. Gets the value of the element. Perform the required actions.

How to do vertical centering of bootstrap How to do vertical centering of bootstrap Apr 07, 2025 pm 03:21 PM

Use Bootstrap to implement vertical centering: flexbox method: Use the d-flex, justify-content-center, and align-items-center classes to place elements in the flexbox container. align-items-center class method: For browsers that do not support flexbox, use the align-items-center class, provided that the parent element has a defined height.

How to set up the framework for bootstrap How to set up the framework for bootstrap Apr 07, 2025 pm 03:27 PM

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

How to write split lines on bootstrap How to write split lines on bootstrap Apr 07, 2025 pm 03:12 PM

There are two ways to create a Bootstrap split line: using the tag, which creates a horizontal split line. Use the CSS border property to create custom style split lines.

How to insert pictures on bootstrap How to insert pictures on bootstrap Apr 07, 2025 pm 03:30 PM

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

How to use bootstrap button How to use bootstrap button Apr 07, 2025 pm 03:09 PM

How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

How to resize bootstrap How to resize bootstrap Apr 07, 2025 pm 03:18 PM

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

See all articles