content logo

Bootstrap Forms:

Bootstrap Subscribe Form in Modal

This code can be a good option for you whenever you want to use both forms and modals at the same time. We have a button in this code. Clicking this button will open the desired modal. This modal includes a subscription form. In the form header section, there is a close icon and a photo to show the content of this form. The subscription button is also a crimson color that changes color and becomes turquoise when the mouse cursor is placed on it.

#Bootstrap Modal Form #Subscribe Form Code #HTML Subscribe Form #HTML Modal with Form

<!-- This script got from www.frontendfreecode.com -->
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="modal-box">
                <!-- Button trigger modal -->
                <button type="button" class="btn btn-primary btn-lg show-modal" data-toggle="modal" data-target="#myModal">
                    view modal
                </button>
                <!-- Modal -->
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                            <div class="modal-body">
                                <div class="icon">
                                    <i class="fa fa-envelope"></i>
                                </div>
                                <h3 class="title">Subscribe!</h3>
                                <p class="description">Lorem Ipsum Uinh Rtyh Ervty Cgyui.</p>
                                <div class="form-group">
                                    <input class="form-control name" type="text" placeholder="Name" />
                                </div>
                                <div class="form-group">
                                    <input class="form-control email" type="email" placeholder="Enter Your Email Address" />
                                </div>
                                <button class="subscribe">Subscribe</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://www.frontendfreecode.com">Frontend Free Code</a>
                                                                            
body {
    background-color: #8BD6BF;
    margin: 20px;
}
.demo {
    background: #24a593;
}
.modal-box {
    font-family: "Roboto", sans-serif;
}
.modal-box .show-modal {
    color: #273c75;
    background-color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-transform: capitalize;
    padding: 10px 15px;
    margin: 80px auto 0;
    border: none;
    outline: none;
    box-shadow: 15px 15px 30px rgba(0, 0, 0, 0.3);
    display: block;
}
.modal-box .show-modal:hover {
    color: #273c75;
    text-decoration: none;
    border: none;
    outline: none;
}
.modal-backdrop.in {
    opacity: 0;
}
.modal-box .modal {
    top: 70px !important;
}
.modal-box .modal-dialog {
    width: 400px;
    margin: 30px auto 10px;
}
.modal-box .modal-dialog .modal-content {
    text-align: center;
    border-radius: 30px;
    box-shadow: 15px 15px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}
.modal-box .modal-dialog .modal-content:before {
    content: "";
    background: #00bfe3;
    position: absolute;
    width: 100%;
    height: 15%;
    top: 0;
    left: 0;
    border-radius: 25px 25px 0 0;
    z-index: 0;
}
.modal-box .modal-dialog .modal-content .close {
    color: #273c75;
    background-color: #fff;
    font-size: 28px;
    text-shadow: none;
    line-height: 33px;
    height: 33px;
    width: 33px;
    opacity: 1;
    border-radius: 50%;
    box-shadow: 0 0 5px #555;
    position: absolute;
    left: auto;
    right: -5px;
    top: -5px;
    z-index: 1;
    transition: all 0.3s;
}
.modal-box .modal-dialog .modal-content .close:hover {
    color: #fff;
    background-color: #273c75;
}
.modal-box .modal-dialog .modal-content .modal-body {
    padding: 0 20px 30px !important;
}
.modal-box .modal-dialog .modal-content .modal-body .icon {
    color: #fff;
    background: #00bfe3;
    font-size: 60px;
    text-align: center;
    text-shadow: 0 0 10px#555 inset;
    line-height: 130px;
    width: 130px;
    height: 130px;
    margin: -25px auto 30px;
    border-radius: 100px;
    box-shadow: 0 0 0 5px #fff inset, 0 0 0 10px #273c75 inset, 7px 7px 2px rgba(144, 144, 144, 0.8);
    display: block;
}
.modal-box .modal-dialog .modal-content .modal-body .title {
    color: #273c75;
    font-size: 50px;
    font-weight: 600;
    text-align: center;
    text-transform: capitalize;
    margin: 0 0 5px 0;
}
.modal-box .modal-dialog .modal-content .modal-body .description {
    color: #00bfe3;
    text-align: center;
    margin: 0 0 15px;
}
.modal-box .modal-dialog .modal-content .modal-body .form-control {
    color: #000;
    background: #e2e2e2;
    font-size: 16px;
    letter-spacing: 1px;
    text-align: center;
    height: 40px;
    padding: 2px 15px 2px 15px;
    border-radius: 50px;
    display: block;
    transition: all 0.3s;
}
.modal-box .modal-dialog .modal-content .modal-body .form-control:focus {
    box-shadow: none;
    border: 1px solid #00bfe3;
}
.modal-box .modal-dialog .modal-content .modal-body .form-control::placeholder {
    color: #909090;
    font-size: 14px;
}
.modal-box .modal-dialog .modal-content .modal-body .subscribe {
    color: #fff;
    background: #273c75;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 10px 38px;
    margin: 0 auto;
    border: none;
    border-radius: 50px;
    display: block;
    transition: all 0.3s;
}
.modal-box .modal-dialog .modal-content .modal-body .subscribe:hover {
    background-color: #00bfe3;
}
@media only screen and (max-width: 576px) {
    .modal-dialog {
        width: 96% !important;
    }
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from www.frontendfreecode.com -->

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
body {
    background-color: #8BD6BF;
    margin: 20px;
}
.demo {
    background: #24a593;
}
.modal-box {
    font-family: "Roboto", sans-serif;
}
.modal-box .show-modal {
    color: #273c75;
    background-color: #fff;
    font-size: 18px;
    font-weight: 600;
    text-transform: capitalize;
    padding: 10px 15px;
    margin: 80px auto 0;
    border: none;
    outline: none;
    box-shadow: 15px 15px 30px rgba(0, 0, 0, 0.3);
    display: block;
}
.modal-box .show-modal:hover {
    color: #273c75;
    text-decoration: none;
    border: none;
    outline: none;
}
.modal-backdrop.in {
    opacity: 0;
}
.modal-box .modal {
    top: 70px !important;
}
.modal-box .modal-dialog {
    width: 400px;
    margin: 30px auto 10px;
}
.modal-box .modal-dialog .modal-content {
    text-align: center;
    border-radius: 30px;
    box-shadow: 15px 15px 30px rgba(0, 0, 0, 0.3);
    position: relative;
}
.modal-box .modal-dialog .modal-content:before {
    content: "";
    background: #00bfe3;
    position: absolute;
    width: 100%;
    height: 15%;
    top: 0;
    left: 0;
    border-radius: 25px 25px 0 0;
    z-index: 0;
}
.modal-box .modal-dialog .modal-content .close {
    color: #273c75;
    background-color: #fff;
    font-size: 28px;
    text-shadow: none;
    line-height: 33px;
    height: 33px;
    width: 33px;
    opacity: 1;
    border-radius: 50%;
    box-shadow: 0 0 5px #555;
    position: absolute;
    left: auto;
    right: -5px;
    top: -5px;
    z-index: 1;
    transition: all 0.3s;
}
.modal-box .modal-dialog .modal-content .close:hover {
    color: #fff;
    background-color: #273c75;
}
.modal-box .modal-dialog .modal-content .modal-body {
    padding: 0 20px 30px !important;
}
.modal-box .modal-dialog .modal-content .modal-body .icon {
    color: #fff;
    background: #00bfe3;
    font-size: 60px;
    text-align: center;
    text-shadow: 0 0 10px#555 inset;
    line-height: 130px;
    width: 130px;
    height: 130px;
    margin: -25px auto 30px;
    border-radius: 100px;
    box-shadow: 0 0 0 5px #fff inset, 0 0 0 10px #273c75 inset, 7px 7px 2px rgba(144, 144, 144, 0.8);
    display: block;
}
.modal-box .modal-dialog .modal-content .modal-body .title {
    color: #273c75;
    font-size: 50px;
    font-weight: 600;
    text-align: center;
    text-transform: capitalize;
    margin: 0 0 5px 0;
}
.modal-box .modal-dialog .modal-content .modal-body .description {
    color: #00bfe3;
    text-align: center;
    margin: 0 0 15px;
}
.modal-box .modal-dialog .modal-content .modal-body .form-control {
    color: #000;
    background: #e2e2e2;
    font-size: 16px;
    letter-spacing: 1px;
    text-align: center;
    height: 40px;
    padding: 2px 15px 2px 15px;
    border-radius: 50px;
    display: block;
    transition: all 0.3s;
}
.modal-box .modal-dialog .modal-content .modal-body .form-control:focus {
    box-shadow: none;
    border: 1px solid #00bfe3;
}
.modal-box .modal-dialog .modal-content .modal-body .form-control::placeholder {
    color: #909090;
    font-size: 14px;
}
.modal-box .modal-dialog .modal-content .modal-body .subscribe {
    color: #fff;
    background: #273c75;
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 10px 38px;
    margin: 0 auto;
    border: none;
    border-radius: 50px;
    display: block;
    transition: all 0.3s;
}
.modal-box .modal-dialog .modal-content .modal-body .subscribe:hover {
    background-color: #00bfe3;
}
@media only screen and (max-width: 576px) {
    .modal-dialog {
        width: 96% !important;
    }
}
</style>

</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-12">
            <div class="modal-box">
                <!-- Button trigger modal -->
                <button type="button" class="btn btn-primary btn-lg show-modal" data-toggle="modal" data-target="#myModal">
                    view modal
                </button>
                <!-- Modal -->
                <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                    <div class="modal-dialog" role="document">
                        <div class="modal-content">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                            <div class="modal-body">
                                <div class="icon">
                                    <i class="fa fa-envelope"></i>
                                </div>
                                <h3 class="title">Subscribe!</h3>
                                <p class="description">Lorem Ipsum Uinh Rtyh Ervty Cgyui.</p>
                                <div class="form-group">
                                    <input class="form-control name" type="text" placeholder="Name" />
                                </div>
                                <div class="form-group">
                                    <input class="form-control email" type="email" placeholder="Enter Your Email Address" />
                                </div>
                                <button class="subscribe">Subscribe</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Frontend Free Code</a></div>

</body>
</html>
Preview