How To Use Modal Bootstrap

Modal Bootstrap

In this tutorial, we are going talk about on Modal Bootstrap. We all know that bootstrap is the front-end designing purpose and this is suit for the mobile for the responsive function. Everyone can learn bootstrap in easy ways even you are a beginner. Today, we talk about the Modal Bootstrap. It is one of the familiar to use in Bootstrap plugin. It contains CSS, jQuery, plugins and other components. We can use to have a sign-up form, confirmation to delete data, and to edit data, etc. Let’s start with:

Modal Bootstrap Example - Source Code with Image

Result

Source code for our Modal Window

For Large Modal
  1. <!-- Large Modal -->
  2. <div class="modal fade" id="largeModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  3. <div class="modal-dialog modal-lg" role="document">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  7. <h4 class="modal-title" id="myModalLabel">Large Modal</h4>
  8. </div>
  9. <div class="modal-body">
  10. Do you have source code, articles, tutorials, web links,
  11. and books to share? You can write your own content here. You can even have your own blog.
  12. </div>
  13. <div class="modal-footer">
  14. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  15. <a href="http://www.sourcecodester.com/"><button type="button" class="btn btn-primary">Submit</button></a>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
Result for the source code above: ResultFor Medium Modal
  1. <!-- Medium Modal -->
  2. <div class="modal fade" id="mediumModal" tabindex="-1" role="dialog" aria-labelledby="myMediulModalLabel">
  3. <div class="modal-dialog modal-md">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  7. <h4 class="modal-title" id="myModalLabel">Medium Modal</h4>
  8. </div>
  9. <div class="modal-body">
  10. Do you have source code, articles, tutorials, web links,
  11. and books to share? You can write your own content here. You can even have your own blog.
  12. </div>
  13. <div class="modal-footer">
  14. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  15. <a href="http://www.sourcecodester.com/"><button type="button" class="btn btn-primary">Submit</button></a>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
Result for the source code above: ResultFor Small Modal
  1. <!-- Small Modal -->
  2. <div class="modal fade" id="smallModal" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
  3. <div class="modal-dialog modal-sm">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  7. <h4 class="modal-title" id="myModalLabel">Small Modal</h4>
  8. </div>
  9. <div class="modal-body">
  10. Do you have source code, articles, tutorials, web links,
  11. and books to share? You can write your own content here. You can even have your own blog.
  12. </div>
  13. <div class="modal-footer">
  14. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  15. <a href="http://www.sourcecodester.com/"><button type="button" class="btn btn-primary">Submit</button></a>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
Result for the source code above: ResultFor Sign-Up Modal
  1. <!-- Sign-Up Modal -->
  2. <div class="modal fade" id="signupModal" tabindex="-1" role="dialog" aria-labelledby="mySigninLabel">
  3. <div class="modal-dialog modal-md">
  4. <div class="modal-content">
  5. <div class="modal-header">
  6. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  7. <h4 class="modal-title" id="myModalLabel">Sign Up Form</h4>
  8. </div>
  9. <div class="modal-body" style="padding:40px 40px;">
  10. <form role="form">
  11. <div class="form-group">
  12. <input type="text" placeholder="username" class="form-control" />
  13. </div>
  14. <div class="form-group">
  15. <input type="text" placeholder="email" class="form-control" />
  16. </div>
  17. <div class="form-group">
  18. <input type="password" placeholder="password" class="form-control" />
  19. </div>
  20. <div class="form-group">
  21. <hr>
  22. </div>
  23. <div class="form-group">
  24. <a href="http://www.sourcecodester.com/"><button type="button" class="btn btn-primary">Submit</button></a>
  25. </div>
  26. </form>
  27. </div>
  28. <div class="modal-footer">
  29. <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
Result for the source code above: Result

Trigger Of Large, Medium, Small, and Sign-Up Modal

  1. <table width="100%" style="margin-top:100px;">
  2. <tr>
  3. <td style="padding: 20px;">
  4. <div class="form-group">
  5. <div class="col-sm-3">
  6. <button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#largeModal">Large Modal</button>
  7. </div>
  8. </div>
  9. </td>
  10. <td>
  11. <div class="form-group">
  12. <div class="col-sm-3">
  13. <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#mediumModal">Medium Modal</button>
  14. </div>
  15. </div>
  16. </td>
  17. </tr>
  18. <tr>
  19. <td colspan="2" height="50"></td>
  20. </tr>
  21. <tr>
  22. <td style="padding: 20px;">
  23. <div class="form-group">
  24. <div class="col-sm-3">
  25. <button type="button" class="btn btn-success btn-lg" data-toggle="modal" data-target="#smallModal">Small Modal</button>
  26. </div>
  27. </div>
  28. </td>
  29. <td>
  30. <div class="form-group">
  31. <div class="col-sm-3">
  32. <button type="button" class="btn btn-warning btn-lg" data-toggle="modal" data-target="#signupModal">Signup Modal</button>
  33. </div>
  34. </div>
  35. </td>
  36. </tr>
Kindly click the "Download Code" button for a full source code of Modal Bootstrap. Share us your thoughts and comments below. Thank you so much for dropping by and reading this tutorial post. For more updates, don’t hesitate and feel free to visit this website more often and please share this with your friends or email me at [email protected]. Practice Coding. Thank you very much.

Add new comment