search
HomeWeb Front-endBootstrap TutorialDetailed explanation of labels, badges, giant screens and headers in Bootstrap

In Bootstrap, there are some components used for prompt information, such as labels, badges, giant screens and headers. This article will introduce you to the prompt information in Bootstrap. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

Related recommendations: "bootstrap tutorial"

tag

In some Web pages, a Tags are used to tell the user some additional information. For example, if a new navigation item is added to the navigation, a "new" tag may be added to tell the user

This effect is deliberately used in the Bootstrap framework Extract it and become a label component, and use the ".label" style to achieve highlighting

The method of use is very simple, you can use an inline label like span

<h3>Example heading <span>New</span>
</h3>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

[Auto-hide]

When there is no content, automatically hide

.label:empty {
    display: none;
}
<h3>Example heading <span></span>
</h3>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

[Color Settings]

and buttons The element button is similar, and the label style also provides a variety of colors:

☑ label-default: default label, dark gray

☑ label-primary: main label, dark blue

☑ label-success: success label, green

☑ label-info: information label, light blue

☑ label-warning: warning label, orange

☑ label -danger: error label, red

Mainly use these class names to modify the background color and text color

<span>Default</span>
<span>Primary</span>
<span>Success</span>
<span>Info</span>
<span>Warning</span>
<span>Danger</span>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

badge

In a sense, the badge effect is very similar to the label effect introduced earlier. It is also used to make some prompt messages. What often appears is the information sent by some systems, such as the system prompts how many messages are unread

In the Bootstrap framework, this effect is called the badge effect, and the "badge" style is used to achieve it

You can use span tags to make them like tags, and then add the badge class

<a>Inbox <span>42</span></a>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

【Auto-hide】

If not New or unread information entries, that is, they do not contain any content, and the badge component can be automatically hidden (implemented through the CSS :empty selector)

.badge:empty {
    display: none;
}
<a>Inbox <span></span></a>

[Button Badge]

The badge has a similar style in the button element button and capsule navigation nav-pills, but the colors are different



Detailed explanation of labels, badges, giant screens and headers in Bootstrap

Giant screen

This is a lightweight, flexible component that can extend to the entire browser viewport to display key content on the website

<div>
  <h1 id="小火柴的蓝色理想">小火柴的蓝色理想</h1>
  <p>好的代码像粥一样,都是用时间熬出来的</p>
  <p><a>Learn more</a></p>
</div>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

If Add rounded corners to the giant screen component and place this component inside the .container element

<div>
    <div>
        <h1 id="小火柴的蓝色理想">小火柴的蓝色理想</h1>
        <p>好的代码像粥一样,都是用时间熬出来的</p>
        <p><a>Learn more</a></p>
    </div>
</div>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

Header

The header component can add appropriate space to the h1 tag and form a certain separation from other parts of the page. It supports the default effect of small elements embedded in h1 tags, and also supports most other components (need to add some additional styles)

.page-header {
    padding-bottom: 9px;
    margin: 40px 0 20px;
    border-bottom: 1px solid #eee;
}
<div>
  <h1>Example page header <small>Subtext for header</small>
</h1>
</div>

Detailed explanation of labels, badges, giant screens and headers in Bootstrap

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of Detailed explanation of labels, badges, giant screens and headers in Bootstrap. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:博客园. If there is any infringement, please contact admin@php.cn delete
Bootstrap: Simplifying Responsive Web DevelopmentBootstrap: Simplifying Responsive Web DevelopmentMay 09, 2025 am 12:13 AM

Bootstrap simplifies the development process mainly through its raster system, predefined components and JavaScript plug-ins. 1. The grid system allows for flexible layout, 2. Predefined components such as buttons and navigation bars simplify style design, 3. JavaScript plug-in enhances interactive functions and improves development efficiency.

Bootstrap: The Key to Responsive Web DesignBootstrap: The Key to Responsive Web DesignMay 08, 2025 am 12:24 AM

Bootstrap is an open source front-end framework developed by Twitter, providing rich CSS and JavaScript components, simplifying the construction of responsive websites. 1) Its grid system is based on a 12-column layout, and the display of elements under different screen sizes is controlled through class names. 2) The component library includes buttons, navigation bars, etc., which are easy to customize and use. 3) The working principle depends on CSS and JavaScript files, and you need to pay attention to handling dependencies and style conflicts. 4) The usage examples show basic and advanced usage, emphasizing the importance of custom functionality. 5) Common errors include grid system calculation errors and style coverage, which require debugging using developer tools. 6) Performance optimization recommendations only introduce necessary components and customize samples using preprocessors

Bootstrap: A Powerful Framework for Web DesignBootstrap: A Powerful Framework for Web DesignMay 07, 2025 am 12:05 AM

Bootstrap is an open source front-end framework developed by the Twitter team to simplify and speed up the web development process. 1.Bootstrap is based on HTML, CSS and JavaScript, and provides a wealth of components and tools for creating modern user interfaces. 2. Its core lies in responsive design, implementing various layouts and styles through predefined classes and components. 3.Bootstrap provides predefined UI components, such as navigation bars, buttons, forms, etc., which are easy to use and adjust. 4. Examples of usage include creating a simple navigation bar and advanced collapsible sidebar. 5. Common errors include version conflicts, CSS overwrites and JavaScript errors, which can be used through the version management tool.

The Power of Bootstrap in React: A Detailed LookThe Power of Bootstrap in React: A Detailed LookMay 06, 2025 am 12:06 AM

Bootstrap can be integrated in React in two ways: 1) CSS and JavaScript files using Bootstrap; 2) Use the React-Bootstrap library. React-Bootstrap provides encapsulated React components, making using Bootstrap in React more natural and efficient.

Using Bootstrap Components in React: A Step-by-Step TutorialUsing Bootstrap Components in React: A Step-by-Step TutorialMay 05, 2025 am 12:09 AM

There are two ways to use Bootstrap components in React projects: 1) CSS and JavaScript of the original Bootstrap; 2) Use libraries designed specifically for React such as react-bootstrap or reactstrap. 1) Install Bootstrap through npm and introduce its CSS file in the entry file, and then use the Bootstrap class name in the React component. 2) After installing react-bootstrap or reactstrap, directly use the React components it provides. Use these methods to quickly build a responsive UI, but pay attention to style loading and JavaScript

Bootstrap in Plain English: Simplifying Web DevelopmentBootstrap in Plain English: Simplifying Web DevelopmentMay 04, 2025 am 12:02 AM

Bootstrap is an open source front-end framework that simplifies web development. 1. It is based on HTML, CSS, JavaScript, and provides predefined styles and components. 2. Use predefined classes and JavaScript plug-ins to implement responsive layout and interactive functions. 3. The basic usage is to introduce CSS and JavaScript files, use classes to create navigation bars, etc. 4. Advanced usage includes custom complex layouts. 5. Check the introduction of class names and files during debugging and use developer tools. 6. The optimization suggestion is to only introduce necessary files, use CDN, and use LESS or Sass when customizing.

Bootstrap and React: Creating Responsive Web ApplicationsBootstrap and React: Creating Responsive Web ApplicationsMay 03, 2025 am 12:13 AM

How to create responsive web applications using Bootstrap and React? By combining Bootstrap's CSS framework and React's componentized architecture, modern, flexible and easy to maintain can be created. The specific steps include: 1) Importing the CSS file of Bootstrap and using its class to style React components; 2) Using React's componentization to manage state and logic; 3) Loading Bootstrap styles as needed to optimize performance; 4) Creating a dynamic interface using React's Hooks and Bootstrap's JavaScript components.

Bootstrap: Frontend Development Made EasierBootstrap: Frontend Development Made EasierMay 02, 2025 am 12:10 AM

Bootstrap is an open source front-end framework that helps developers quickly build responsive websites. 1) It provides predefined styles and components such as grid systems and navigation bars. 2) Implement style and dynamic interaction through CSS and JavaScript files. 3) The basic usage is to introduce files and build pages with class names. 4) Advanced usage includes custom styles through Sass. 5) Frequently asked questions include style conflicts and JavaScript component issues, which can be solved through developer tools and modular management. 6) Performance optimization is recommended to selectively introduce modules and rationally use grid systems.

See all articles

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

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.