Example : Different formats of html Checkbox in bootstrap4.

Bootstrap4 Checkbox

<!DOCTYPE html>
<html lang="en">
  
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>A typical Bootstrap Form Template</title>

        <!-- Bootstrap CSS 4.5.2 -->        
        <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> -->
        
        <link
        rel="stylesheet"
        href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
        />

        <style>

            label{
                color:blue;
            }

            .edu{
                color:red; 
            }

        </style>
        
    </head>

    <body>
        <section>
            <div class="container text-center">
                <h1>Format of Html Check Box Fields on a Form in Bootstrap4</h1>
            </div>
        </section>

        <!-- Normal Input Fields -->
        <section>
            <div class="container my-4">
                <div class="card">
                    
                    <div class="card-header">
                        <h2>Check Box Input Fields</h2>
                    </div>

                    <div class="card-body">
                        <form action="" method="post" name="form1" id="form2">

                        <div class="edu">Education</div>

                                <div class="form-check form-check-inline">
                                    <input type="checkbox" class="form-check-input" name="nm1" id="nm2" value="Non-Matric" checked/>
                                    <label class="form-check-label" for="nm0">Non-Matric</label>
                                </div>

                                <div class="form-check form-check-inline">
                                    <input type="checkbox" class="form-check-input" name="mat1" id="mat2" value="Matric"/>
                                    <label class="form-check-label" for="mat0">Matric</label>
                                </div>

                                <div class="form-check form-check-inline">
                                    <input type="checkbox" class="form-check-input" name="inter1" id="inter2" value="Intermediate"/>
                                    <label class="form-check-label" for="inter0">Intermediate</label>
                                </div>

                                <div class="form-check form-check-inline">
                                    <input type="checkbox" class="form-check-input" name="grad1" id="grad2" value="Graduate"/>
                                    <label class="form-check-label" for="grad3">Graduate</label>
                                </div>

                                <div class="form-check form-check-inline">
                                    <input type="checkbox" class="form-check-input" name="pgrad1" id="pgrad2" value="Post-Graduate"/>
                                    <label class="form-check-label" for="pgrad0">Post-Graduate</label>
                                </div>

                                <div class="form-check form-check-inline">
                                    <input type="checkbox" class="form-check-input" name="ot1" id="ot2" value="Other" disabled/>
                                    <label class="form-check-label" for="ot0">Other</label>
                                </div> 

                            <hr/>

                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" name="nm1" id="nm2" value="Non-Matric" checked/>
                                    <label class="form-check-label" for="nm0">Non-Matric</label>
                                </div>

                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" name="mat1" id="mat2" value="Matric"/>
                                    <label class="form-check-label" for="mat0">Matric</label>
                                </div>

                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" name="inter1" id="inter2" value="Intermediate"/>
                                    <label class="form-check-label" for="inter0">Intermediate</label>
                                </div>

                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" name="grad1" id="grad2" value="Graduate"/>
                                    <label class="form-check-label" for="grad3">Graduate</label>
                                </div>

                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" name="pgrad1" id="pgrad2" value="Post-Graduate"/>
                                    <label class="form-check-label" for="pgrad0">Post-Graduate</label>
                                </div>

                                <div class="form-check">
                                    <input type="checkbox" class="form-check-input" name="ot1" id="ot2" value="Other"/>
                                    <label class="form-check-label" for="ot0">Other</label>
                                    <input type="text" class="form-control" id="other_tb"/>
<!--<input type="text" id="other_tb"/>
-->
                                </div>
                        </form>
                    </div>

                    <div class="card-footer text-center">
                        Copyright 2020
                    </div>

                </div>
            </div>
        </section>        
            
        <!-- Bootstrap JS, Popper.js, and jQuery -->
        <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

        <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> -->

    </body>
</html>

Loading

Categories: Bootstrap

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.