When we have to quote some content on a webpage, we can use a panel. We place the content inbox with some padding around it. A bootstrap panel is indicated with a “panel” class.
Example: This example describe the basic code to make a panel.
<!DOCTYPE html><html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Panels</title> <link rel="stylesheet" href= <script src= </script> <script src= </script> <style> .panel { margin: 5px; } </style></head> <body> <h1 style="color:green; text-align:center;"> GeeksforGeeks </h1> <h2 style="text-align:center;"> Panel </h2> <div class="panel panel-default"> <div class="panel-body"> This is a body of bootstrap panel </div> </div></body> </html> |
Output:
Different classes of panel: There are sections available in a Bootstrap pannel like a Bootstrap Cards. All the body parts of Bootstrap Panel are described below:
- panel body It is used to define body of a panel.
- panel heading: It is used to give heading to a panel.
- panel footer: It is used to give footer class to panel.
- panel group: It is used to collect different panels together into a group.
panel with contextual classes: Contextual classes are used to color the panel.
- panel-default
- panel-primary
- panel-success
- panel-info
- panel-warning
- panel-danger
Panel Heading: It is used to create a panel with heading.
- Example:
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Panels</title><linkrel="stylesheet"href=<scriptsrc=</script><scriptsrc=</script><style>.panel {margin: 5px;}</style></head><body><h1style="color:green; text-align:center;">GeeksforGeeks</h1><h2style="text-align:center;">Panel heading</h2><divclass="panel panel-default"><divclass="panel-heading">This is a heading of bootstrap panel</div><divclass="panel-body">This is a body of bootstrap panel</div></div></body></html> - Output:

Panel Footer: It is used to add footer into the panel.
- Example:
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Panels</title><linkrel="stylesheet"href=<scriptsrc=</script><scriptsrc=</script><style>.panel {margin: 5px;}</style></head><body><h1style="color:green; text-align:center;">GeeksforGeeks</h1><h2style="text-align:center;">Panel footer</h2><divclass="panel panel-default"><divclass="panel-body">This is a body of bootstrap panel</div><divclass="panel-footer">This is a footer of bootstrap panel</div></div></body></html> - Output:

Panel Groups: It is used to collect panels together in to a group.
- Example:
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Panels</title><linkrel="stylesheet"href=<scriptsrc=</script><scriptsrc=</script><style>.panel {margin: 5px;}</style></head><body><h1style="color:green; text-align:center;">GeeksforGeeks</h1><divclass="container"><h2>Panel Group</h2><p>The panel-group class clears the bottom-margin.Try to remove the class and see what happens.</p><divclass="panel-group"><divclass="panel panel-default"><divclass="panel-body">This is bootstrap panel 1</div></div><divclass="panel panel-default"><divclass="panel-body">This is bootstrap panel 2</div></div><divclass="panel panel-default"><divclass="panel-body">This is bootstrap panel 3</div></div><divclass="panel panel-default"><divclass="panel-body">This is bootstrap panel 4</div></div></div></div></body></html> - Output

Panels with contextual classes: They are used to highlight the panel content as per different situations of use.
- Example:
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>Panels</title><linkrel="stylesheet"href=<scriptsrc=</script><scriptsrc=</script><style>.panel {margin: 5px;}</style></head><body><h1style="color:green; text-align:center;">GeeksforGeeks</h1><divclass="container"><h2>Panels with Contextual Classes</h2><divclass="panel-group"><divclass="panel panel-default"><divclass="panel-heading">panel-default</div><divclass="panel-body">Content</div></div><divclass="panel panel-primary"><divclass="panel-heading">panel-primary</div><divclass="panel-body">Content</div></div><divclass="panel panel-success"><divclass="panel-heading"> panel-success</div><divclass="panel-body">Content</div></div><divclass="panel panel-info"><divclass="panel-heading"> panel-info</div><divclass="panel-body">Content</div></div><divclass="panel panel-warning"><divclass="panel-heading">panel-warning</div><divclass="panel-body">Content</div></div><divclass="panel panel-danger"><divclass="panel-heading">panel-danger</div><divclass="panel-body">Content</div></div></div></body></html> - Output:

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.


