Bootstrap Panels
Posted by Superadmin on April 30 2023 05:49:56

Bootstrap Panels

By Mrunali PangeMrunali Pange
  

Bootstrap Panels

Introduction to Bootstrap Panels

The content of data must be showing clean, neat and suitable. Having space in contents, colorful header and footer, and border for content looks attractive. Attractive content is easy for reading and understanding. Bootstrap panel work exactly similar for content. It is used for border-box for content with specific padding. It works for content, header, footer and also in a different color. Basic bootstrap panel work using ” .panel ” class in a div element, with this class ” .panel-default ” class also required.

Example:

<div class="panel panel-default">
<div class="panel-body"> THIS IS A DEFAULT PANEL </div>
</div>

Output:

Bootstrap Panel 1-1

Types of Bootstrap Panels

Panels are categorized with different classifications and goals which is the following. Content has a heading, body, and footer part. To make elegant content and style with purpose, the panel comes up with these categories:

1. Panel with the Heading

In panel heading, border-box surrounded with content heading and content body with format padding. Heading panel add class = “panel-heading” and content body add class = “panel-body”.

Code:

<div class="panel panel-default">
<div class="panel-heading"> Content Heading </div>
<div class="panel-body"> Content Body </div>
</div>

Output:

panel with heading

You can add the class = “panel-title” to modify the heading of content separately. This class is used rarely because the panel heading class modify all styles by themselves.     

2. Panel with Footer

In panel footer, border-box surrounded with content footer and content body with format padding. Footer panel add class = “panel-footer” and content body add class = “panel-body”.

Code:

<div class="panel panel-default">
<div class="panel-body"> Content Body </div>
<div class="panel-footer"> Content Footer </div>
</div>

Output:

Bootstrap Panel 1-3

3. Panel Group

This panel is used for binding the many panels at a time. It removes the margin of the lower panel and makes a group of panels.

Code:

<div class="panel-group">
<div class="panel panel-default">
<div class="panel-body">Content Body1</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"> Content Heading </div>
<div class="panel-body"> Content Body </div>
</div>
<div class="panel panel-default">
<div class="panel-body"> Content Body3 </div>
<div class="panel-footer"> Content Footer </div></div>
</div>

Output:

group of panels

4. Panels with Contextual Classes

To get a more meaningful context bootstrap panel design different classes for context. Every contextual class heading has a different color to show the impact of context. These panel classes are below with their examples and outputs,

Code:

<div class="panel panel-default">
<div class="panel-heading"> Content Heading </div>
<div class="panel-body"> Content Body </div>
</div>

Output:

Bootstrap Panel 1-5

Code:

<div class="panel panel-primary">
<div class="panel-heading"> Content Heading with panel-primary class /div>
<div class="panel-body"> Content Body2 </div>
</div>

Output:

Bootstrap Panel 1-6

Code:

<div class="panel panel-success">
<div class="panel-heading"> Content Heading with panel-success class </div>
<div class="panel-body"> Content Body3 </div>
</div>

Output:

Bootstrap Panel 1-7

Code:

<div class="panel panel-info">
<div class="panel-heading"> Content Heading with panel-info class </div>
<div class="panel-body"> Content Body4</div>
</div>

Output:

Informative class output

Code:

<div class="panel panel-warning">
<div class="panel-heading"> Content Heading with panel-warning class </div>
<div class="panel-body"> Content Body5</div>
</div>

Output:

warning class output

Code:

<div class="panel panel-danger">
<div class="panel-heading"> Content Heading with panel-danger class </div>
<div class="panel-body"> Content Body6</div>
</div>

Output:

Meaning of danger output

Examples of Bootstrap Panels

Following are the examples explained in detail,

Example #1: Simple Bootstrap Panel

This is a simple bootstrap default panel example where placed panel heading, panel footer, and description body.

Code:

<div class="container">
<div class="panel panel-default">
<div class="panel-heading"> Content Heading </div>
<div class="panel-body"> Content Body <br/> Panel body for context </div>
<div class="panel-footer"> Content Footer </div>
</div>
</div>

Output:

Bootstrap Panel 1-11

Example #2: Bootstrap Panel with Table

Code:

<div class="container">
<div class = "panel panel-primary">
<div class = "panel-heading">Table Name</div>
<table class = "panel-body table ">
<tr>
<th> Brand Name </th>
<th> Brand Price (Rs) </th>
</tr>
<tr>
<td> Brand A </td>
<td> 500 </td>
</tr>
<tr>
<td> Brand B </td>
<td> 400 </td>
</tr>
<tr>
<td> Brand C </td>
<td> 700 </td>
</tr>

Output:

Table class output

Example #3: Bootstrap Panel with List

Code:

<div class="container">
<h2>Panels with Contextual Classes</h2>
<div class = "panel panel-info">
<div class ="panel-heading">List Name</div>
<div class = "panel-body">
<p> Basic List of content is below</p>
<ul class = "list-group">
<li class = "list-group-item"> List content1 </li>
<li class = "list-group-item"> List content2 </li>
<li class = "list-group-item"> List content3 </li>
<li class = "list-group-item"> List content4 </li>
</ul>
</div>
</div>
</div>

Output:

Contextual classes output

Conclusion

Sometimes Web application context looks clumsy and uneasy to read. It works to border and style with padding. Every content gets formatted padding with a meaningful context. For meaningful context used much class of bootstrap panel. This makes context readable, attractive and more effective.