Bootstrap Modal: This dialog box/popup window which will be displayed on top of the current page in the form of Window disabling the background window. Once you click on the along background or the close button the Modal box disappears completely.
How to Build Bootstrap 4 Modal:
<div class="container mt-4"> <h2 class="pb-4 pt-4">Bootstrap 4 Modal Example</h2> <p>Here is default presentation of Bootstrap Model</p> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#demo"> Click for Modal Window </button> <div class="modal" id="demo"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="modal-title">Bootstrap 4 Modal Heading</h4> <button type="button" class="close" data-dismiss="modal">X</button></div> <!-- Modal body --> <div class="modal-body">Main Content</div> <!-- Modal footer --> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button> </div> </div> </div> </div> </div>
.modal-open{overflow:hidden} .modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1050;display:none;overflow:hidden;outline:0} .modal-open .modal{overflow-x:hidden;overflow-y:auto} .modal-dialog{position:relative;width:auto;margin:.5rem;pointer-events:none} .modal.fade .modal-dialog{transition:-webkit-transform .3s ease-out;transition:transform .3s ease-out;transition:transform .3s ease-out,-webkit-transform .3s ease-out;-webkit-transform:translate(0,-25%);transform:translate(0,-25%)} @media screen and (prefers-reduced-motion:reduce){.modal.fade .modal-dialog{transition:none}} .modal.show .modal-dialog{-webkit-transform:translate(0,0);transform:translate(0,0)} .modal-dialog-centered{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:calc(100% - (.5rem * 2))} .modal-content{position:relative;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:100%;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0} .modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000} .modal-backdrop.fade{opacity:0} .modal-backdrop.show{opacity:.5} .modal-header{display:-ms-flexbox;display:flex;-ms-flex-align:start;align-items:flex-start;-ms-flex-pack:justify;justify-content:space-between;padding:1rem;border-bottom:1px solid #e9ecef;border-top-left-radius:.3rem;border-top-right-radius:.3rem} .modal-header .close{padding:1rem;margin:-1rem -1rem -1rem auto} .modal-title{margin-bottom:0;line-height:1.5} .modal-body{position:relative;-ms-flex:1 1 auto;flex:1 1 auto;padding:1rem} .modal-footer{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:end;justify-content:flex-end;padding:1rem;border-top:1px solid #e9ecef} .modal-footer>:not(:first-child){margin-left:.25rem}.modal-footer>:not(:last-child){margin-right:.25rem} .modal-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll} @media (min-width:576px){.modal-dialog{max-width:500px;margin:1.75rem auto}.modal-dialog-centered{min-height:calc(100% - (1.75rem * 2))}.modal-sm{max-width:300px}} @media (min-width:992px){.modal-lg{max-width:800px}}
Now we are going to study various styles associated with Bootstrap 4 Modal
Bootstrap Modal Default Open: To make Bootstrap modal open default you need to add specific JS script to the whole layout.
<script type="text/javascript"> $(window).on('load',function(){ $('#demo').modal('show'); }); </script>
There are three default modal sizes that are used for which specific classes needs to be added with .modal-dialog element.
Bootstrap modal Height: You can add specific heights to the Modal dialog box with CSS and JS to make it match your website layout.
To make Bootstrap modal dialog box vertical center you need to add specific class to .modal-dialog-centered to .modal-dialog
You can also specify tooltips to the bootstrap modal by adding these values in the modal body.
Check out a simple bootstrap modal form that can take values and submit the data to the database just like a normal website form.
Bootstrap Confirm Dialog: You can create confirm delete with modal to add YES/NO options that can be easily adjusted with submit form that can be further added in the database.
You can also specify tooltips to the bootstrap modal by adding these values in the modal body. When they are used inside modal tooltips tends to show behaviour of modal only and close out once their backdrop are clicked.
Modal are used extensively as a way to get your message and information being delivered to user as popup message box. In popular terms they are also known as ‘Bootstrap Dialog Box or Message box‘.
Also check out this complete bootstrap modal tutorial with template
Toys have always played a crucial role in childhood, fueling imagination, creativity, and learning. Whether you're looking for educational playsets,…
Toys are an essential part of childhood, shaping creativity, learning, and fun-filled memories. Whether it’s the soft embrace of plush…
Toys are a gateway to imagination, creativity, and learning. Whether it’s a child’s first plush toy, a set of engaging…
Toys are more than just playthings; they help children explore, learn, and develop essential life skills. From interactive sensory toys…
Toys are more than just playthings; they are tools that foster creativity, motor skills, and cognitive development in children. From…
Toys play an integral role in a child’s growth and development. They spark creativity, encourage learning, and provide endless hours…