Panel refers to a bordered box with some padding around its content.
Bootstrap 4 provides the .panel class to create the panel. The .panel-body class is used for the content inside the panel.
Bootstrap 4 Basic Panel Example:
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap 4 Basic Panel Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Bootstrap 4 Basic Panel Example</h2> <div class="panel panel-default"> <div class="panel-body">Bootstrap 4 Basic Panel</div> </div> </div> </body> </html> |
Output:
Bootstrap 4 Panel Heading
The .panel-heading class is used to add a heading to the panel.
Bootstrap 4 Panel Heading Example:
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap 4 Panel Heading Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Bootstrap 4 Panel Heading Example</h2> <div class="panel panel-default"> <div class="panel-heading">Bootstrap 4 Panel Heading</div> <div class="panel-body">Bootstrap 4 Panel Content</div> </div> </div> </body> </html> |
Output:
Bootstrap 4 Panel Footer
The .panel-footer class is used to add a footer to the panel.
Bootstrap 4 Panel Footer Example:
<!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap 4 Panel Footer Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <h2>Bootstrap 4 Panel Footer Example</h2> <div class="panel panel-default"> <div class="panel-heading">Bootstrap 4 Panel Heading</div> <div class="panel-body">Bootstrap 4 Panel Content</div> <div class="panel-footer">Bootstrap 4 Panel Footer</div> </div> </div> </body> </html> |
Output: