content logo

Bootstrap Toggle Switches:

Toggle Switch for Trial Product using Bootstrap

In this code, we have a card that displays the specifications of the product whose trial version is to be provided to the user. This product can be provided to the user on an yearly or monthly basis, and the status of the product is determined yearly or monthly by a toggle switch. This switch changes color from white to blue when selected.

#HTML Toggle Switches

#Pure CSS Toggle Switch

#Switch Button Code

#Bootstrap Stylish Toggle Switch


<!-- This script got from www.frontendfreecode.com -->
<div class="container height-100 d-flex justify-content-center align-items-center">
    <div class="card">
        <div class="p-3 py-5">
            <div class="d-flex justify-content-between align-items-center"> <span class="text-uppercase views">100k Pageviews</span>
                <div class="price"> <span>$16.00</span> <span>/month</span> </div>
            </div>
            <div class="mt-2"> <input type="range" class="form-range" id="customRange1"> </div>
            <div class="mt-2 text-center">
                <div class="form-check form-switch flex-row d-flex align-items-center"> <label>Monthly</label> <input class="form-check-input ms-2" type="checkbox" id="flexSwitchCheckDefault"> <label class="form-check-label ms-2" for="flexSwitchCheckDefault">Yearly</label> <span class="badge-orange">10% discount</span> </div>
            </div>
        </div> <span class="border-bottom"></span>
        <div class="p-3 d-flex justify-content-between align-items-center py-4">
            <div class="d-flex flex-column">
                <div class="d-flex align-items-center"> <i class='bx bx-check text-success'></i> <span class="ms-1">Unlimited websites</span> </div>
                <div class="d-flex align-items-center"> <i class='bx bx-check text-success'></i> <span class="ms-1">100% Data Ownership</span> </div>
                <div class="d-flex align-items-center"> <i class='bx bx-check text-success'></i> <span class="ms-1">Email Reports</span> </div>
            </div> <button class="btn btn-dark h-100">Start My Trial</button>
        </div>
    </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://www.frontendfreecode.com">Free Frontend</a>
                                                                            
body {
    background-color: #f1f5fe
}
.height-100 {
    height: 100vh
}
.views {
    font-size: 13px;
    margin-top: 7px
}
.card {
    width: 400px;
    border: none;
    border-radius: 4px
}
.price span:nth-child(1) {
    font-weight: 700;
    font-size: 24px
}
.price span:nth-child(2) {
    font-weight: 300;
    font-size: 14px
}
.badge-orange {
    height: 20px;
    width: 89px;
    margin-left: 10px;
    padding-bottom: 3px;
    background-color: red;
    font-size: 13px;
    color: #fff;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center
}
<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css' rel='stylesheet'>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js'></script>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from www.frontendfreecode.com -->

<link href='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css' rel='stylesheet'>
<link href='https://cdn.jsdelivr.net/npm/boxicons@latest/css/boxicons.min.css' rel='stylesheet'>
<script type='text/javascript' src='https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js'></script>
<style>
body {
    background-color: #f1f5fe
}
.height-100 {
    height: 100vh
}
.views {
    font-size: 13px;
    margin-top: 7px
}
.card {
    width: 400px;
    border: none;
    border-radius: 4px
}
.price span:nth-child(1) {
    font-weight: 700;
    font-size: 24px
}
.price span:nth-child(2) {
    font-weight: 300;
    font-size: 14px
}
.badge-orange {
    height: 20px;
    width: 89px;
    margin-left: 10px;
    padding-bottom: 3px;
    background-color: red;
    font-size: 13px;
    color: #fff;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center
}
</style>

</head>
<body>
<div class="container height-100 d-flex justify-content-center align-items-center">
    <div class="card">
        <div class="p-3 py-5">
            <div class="d-flex justify-content-between align-items-center"> <span class="text-uppercase views">100k Pageviews</span>
                <div class="price"> <span>$16.00</span> <span>/month</span> </div>
            </div>
            <div class="mt-2"> <input type="range" class="form-range" id="customRange1"> </div>
            <div class="mt-2 text-center">
                <div class="form-check form-switch flex-row d-flex align-items-center"> <label>Monthly</label> <input class="form-check-input ms-2" type="checkbox" id="flexSwitchCheckDefault"> <label class="form-check-label ms-2" for="flexSwitchCheckDefault">Yearly</label> <span class="badge-orange">10% discount</span> </div>
            </div>
        </div> <span class="border-bottom"></span>
        <div class="p-3 d-flex justify-content-between align-items-center py-4">
            <div class="d-flex flex-column">
                <div class="d-flex align-items-center"> <i class='bx bx-check text-success'></i> <span class="ms-1">Unlimited websites</span> </div>
                <div class="d-flex align-items-center"> <i class='bx bx-check text-success'></i> <span class="ms-1">100% Data Ownership</span> </div>
                <div class="d-flex align-items-center"> <i class='bx bx-check text-success'></i> <span class="ms-1">Email Reports</span> </div>
            </div> <button class="btn btn-dark h-100">Start My Trial</button>
        </div>
    </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>

</body>
</html>
Preview