Bootstrap Panels (Panels)
This chapter will explain Bootstrap panels (Panels). The panel component is used to insert DOM components into a box. To create a basic panel, you only need to add to the
Example
<div class=">panel panel-default
"
<div class="panel-body">This is a basic panel
div
div
Try it »
The result is as follows:
Panel Heading
We can add a panel heading in the following two ways:
- Use .panel-heading class can easily add a heading container to the panel.
- Use the .panel-title from the class take effect
-
to add a heading with a predefined style.
The following example demonstrates these two ways:
Example
<div class=">panel panel-default
"
<div class="panel-heading">Panel Heading Without a Title
div
<div class="panel-body">Panel Content
div
div
<div class=">panel panel-default
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading With a Title
h3
div
<div class="panel-body">Panel Content
div
div
Try it »
The result is as follows:
Panel Footer
We can add a footer to the panel by simply putting buttons or subtext inside a div with class .panel-footer 's
Example
<div class=">panel panel-default
"
<div class="panel-body">This is a basic panel
div
<div class="panel-footer">Panel Footer
div
div
Try it »
The result is as follows:
Panel footers do not inherit the color and border from contextual panels, because they are not part of the foreground content.
Contextual Panels
Use the contextual state classes panel-primary、panel-success、panel-info、panel-warning、panel-dangerto set up contextual panels, as shown in the example below:
Example
<div class=">panel panel-primary
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading
h3
div
<div class="panel-body">This is a basic panel
div
div
<div class=">panel panel-success
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading
h3
div
<div class="panel-body">This is a basic panel
div
div
<div class=">panel panel-info
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading
h3
div
<div class="panel-body">This is a basic panel
div
div
<div class=">panel panel-warning
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading
h3
div
<div class="panel-body">This is a basic panel
div
div
<div class=">panel panel-danger
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading
h3
div
<div class="panel-body">This is a basic panel
div
div
Try it »
The result is as follows:
Panels with Tables
To create a borderless table in a panel, we can use the class .tablein the panel. Suppose there is a
The following example demonstrates this:
Example
<div class=">panel panel-default
"
<div class="panel-heading">
<h3 class="panel-title">Panel Heading
h3
div
<div class="panel-body">This is a basic panel
div
<table class="table">
<th Product th>
<th Price th>
<tr>
<td>Product A
td
<
td
200
td
tr
<
tr
<
tdProduct B
td
<
td
400
td
tr
table
div
<
div
class
=
"panel panel-default
"
<div class="panel-heading">Panel Heading
div
<table class="table">
<th Product th>
<th Price th>
<tr>
<td>Product A
td
<
td
200
td
tr
<
tr
<
tdProduct B
td
<
td
400
td
tr
table
divTry it »
The result is as follows:
Panels with List Groups
We can include a list group in any panel by adding the
Example
<div class=">panel panel-default
"
<div class="panel-heading">Panel Heading
div
<div class="panel-body">
<p>This is a basic panel content. This is a basic panel content. This is a basic panel content. This is a basic panel content. This is a basic panel content. This is a basic panel content. This is a basic panel content. This is a basic panel content.
p
div
<ul class="list-group">
<li class="list-group-item">Free domain registration
li
<li class="list-group-item">Free Window hosting space
li
<li class="list-group-item">Number of images
li
<li class="list-group-item">24*7 support
li
<li class="list-group-item">Annual renewal cost
li
ul
div
Try it »
The result is as follows:
Panel footers do not inherit the color and border from contextual panels, because they are not part of the foreground content.