Detailed introduction to Bootstrap panel
1. Panels
Panels (Panels) are a new component of the Bootstrap framework. Its main function is to handle some functions that other components cannot complete. There are also different source codes in different versions:
☑ Less version: the corresponding source code file is panels.less
☑ Sass version: the corresponding source code file is _panels.scss
☑ Compiled Bootstrap: Corresponds to lines 4995 to 5302 of the bootstrap.css file
Basic panel
The basic panel is very simple, it is a div container using "panel" Style, generates a text display block with a border, and adds a "div.panel-body" inside to place the main content of the panel
.panel { margin-bottom: 20px; background-color: #fff; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }.panel-body { padding: 15px; }
<div class="panel"><div class="panel-body">我是一个基础面板</div></div>
【Components】
The basic panel looks too simple. In order to enrich the functions of the panel, Bootstrap specially adds the "Panel Header" and "Page Footer" effects to the panel:
☑ panel-heading: used to set the panel head style
☑ panel-footer: used to set the panel tail style
panel-heading and panel-footer are only spacing and rounded corners and other styles are set
.panel-heading { padding: 10px 15px; border-bottom: 1px solid transparent; border-top-left-radius: 3px; border-top-right-radius: 3px; }.panel-heading > .dropdown .dropdown-toggle { color: inherit; }.panel-title { margin-top: 0; margin-bottom: 0; font-size: 16px; color: inherit; }.panel-title > a { color: inherit; }.panel-footer { padding: 10px 15px; background-color: #f5f5f5; border-top: 1px solid #ddd; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; }
<div class="panel"><div class="panel-heading">小火柴的蓝色理想</div><div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div></div>
Color panel
The panel style does not style the theme, but the theme style is Set via panel-default. In the Bootstrap framework, in addition to the default theme style, the panel component also includes the following theme styles, forming a colored panel:
☑ panel-primary: key blue
☑ panel- success: success green
☑ panel-info: information blue
☑ panel-warning: warning yellow
☑ panel-danger: danger red
Use The method is very simple. You only need to add the class name you need based on the class name of the panel.
<div class="panel"><div class="panel-heading">小火柴的蓝色理想</div> <div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div></div><div class="panel panel-default"><div class="panel-heading">小火柴的蓝色理想</div><div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div></div><div class="panel panel-primary"><div class="panel-heading">小火柴的蓝色理想</div><div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div></div> <div class="panel panel-success"> <div class="panel-heading">小火柴的蓝色理想</div> <div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div> </div><div class="panel panel-info"><div class="panel-heading">小火柴的蓝色理想</div> <div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div> </div><div class="panel panel-warning"><div class="panel-heading">小火柴的蓝色理想</div> <div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div></div> <div class="panel panel-danger"><div class="panel-heading">小火柴的蓝色理想</div> <div class="panel-body">前端学习博客</div><div class="panel-footer">作者:小火柴</div></div>
Table nesting
Generally speaking, the panel can be understood as a Area, when using the panel, the required content will be placed in the panel-body, which may be pictures, tables or lists, etc.
Add the .table
class to the tables in the panel that do not require borders , making the entire panel look more like an overall design. If it is a panel with .panel-body
, we add a border above the table, which looks like a separation effect
<div class="panel panel-default"><div class="panel-heading">小火柴的蓝色理想</div><div class="panel-body"><p>前端学习博客</p></div><table class="table"><thead> <tr><th>#</th><th>名称</th><th>博客数量</th><th>难度</th> </tr></thead><tbody> <tr><th scope="row">1</th><td>HTML</td><td>30</td><td>较难</td> </tr> <tr><th scope="row">2</th><td>CSS</td><td>60</td><td>较难</td> </tr> <tr><th scope="row">3</th><td>javascript</td><td>200</td><td>很难</td> </tr></tbody></table></div>
If there is no . panel-body
, the panel title will be connected to the table without any gaps
List group nesting
You can simply add a list group with the maximum width to any panel
<div class="panel panel-default"><div class="panel-heading">小火柴的蓝色理想</div> <div class="panel-body"><p>前端学习博客</p></div><ul class="list-group"> <li class="list-group-item">HTML</li><li class="list-group-item">CSS</li> <li class="list-group-item" >javascript</li> <li class="list-group-item">bootstrap</li> <li class="list-group-item">jquery</li> </ul> </div>
The above is the detailed content of Detailed introduction to Bootstrap panel. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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

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.

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.

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.

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 the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

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-
