Bootstrap4 Modal
A modal is a child window overlaid on the parent window. Typically, its purpose is to display content from a separate source, allowing some interaction without leaving the parent window. A child window can provide information, interaction, etc.
How to Create a Modal
The following example creates a simple modal effect:
Example
<button type="button" class=">btn btn-primary
"
data-toggle
=
"
modal
"
data-target
=
"
#myModal
"
Open Modal
button
<div class=">modal fade
"
id
=
"
myModal
"
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Modal Header
h4
<button type="button" class="close" data-dismiss="modal" ×button div>
<div class="modal-body">Modal Content..
div
<div class="modal-footer">
<button type="button" class=">btn btn-secondary
"
data-dismiss
=
"
modal
"
Close
button
div
div
div
div
Try it »
Modal Size
We can create a small modal by adding the .modal-sm class, and a large modal with the .modal-lg class.
The size class is placed on the
element after the .modal-dialog class:
Example - Small Modal
<div class=">modal-dialog modal-sm
"
Try it »
Example - Large Modal
<div class=">modal-dialog modal-lg
"
Try it »