Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Bootstrap Contact Form inside Modal</title> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script> <style> body { color: #566787; background: #f5f5f5; font-family: "Varela Round", sans-serif; } .form-control:focus { border-color: #8464ca; box-shadow: 0 0 8px #beace3; } .contact-modal { width: 600px; padding: 50px; margin: 30px auto; } .contact-modal h4 { font-size: 26px; display: inline-block; } .contact-modal .form-control, .contact-modal .btn { min-height: 38px; border-radius: 1px; outline: none; } .contact-modal .btn-primary { min-width: 100px; background: #8464ca; border: none; } .contact-modal .btn-primary:hover { background: #6d45c0; } .contact-modal .btn-primary:focus { box-shadow: 0 0 8px rgba(132, 100, 202, 0.6); } .contact-modal .btn-link { color: #6d45c0; } .contact-modal label { opacity: 0.9; font-weight: normal; font-size: 95%; } .contact-modal textarea { resize: vertical; } .contact-modal.modal-dialog { width: 480px; } .contact-modal .modal-header { padding: 20px 35px 14px; } .contact-modal .modal-content { border-radius: 1px; } .contact-modal .close { position: absolute; right: 35px; top: 25px; } .contact-modal .modal-body { padding: 20px 35px 35px; } .hint-text { opacity: 0.8; } .trigger-btn { display: inline-block; margin: 100px auto; } </style> </head> <body> <div class="text-center"> <!-- Button HTML (to Trigger Modal) --> <a href="#myModal" class="trigger-btn" data-toggle="modal">Click to Open Contact Modal</a> </div> <!-- Modal HTML --> <div id="myModal" class="modal fade"> <div class="modal-dialog contact-modal"> <div class="modal-content"> <div class="modal-header"> <h4 class="modal-title">Contact Us</h4> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> </div> <div class="modal-body"> <form action="/examples/actions/confirmation.php" method="post"> <div class="form-group"> <label for="inputName">Name</label> <input type="text" class="form-control" id="inputName" required> </div> <div class="form-group"> <label for="inputEmail">Email</label> <input type="email" class="form-control" id="inputEmail" required> </div> <div class="form-group"> <label for="inputMessage">Message</label> <textarea class="form-control" id="inputMessage" rows="4" required></textarea> </div> <input type="submit" class="btn btn-primary" value="Send"> <input type="button" class="btn btn-link" data-dismiss="modal" value="Cancel"> </form> </div> </div> </div> </div> </body> </html>