Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Creating Credit Card Form Using Bootstrap

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 1.43k
    Comment on it

    Hello readers, Today in my blog I have tried to create credit card form using Bootstrap.

     

    In the HTML, I need to create an outer div with the class name as credit card div and had 2 nested div inside it.

     

    With the help of Bootstrap framework classes, I have tried to create it.

     

    Below is the HTML code for it :-

    <!DOCTYPE html>
    
    <head>
    
    <meta charset="utf-8">
    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    
    <title>Credit Card Form</title>
    
    
    <!-- Fonts css file -->
    
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700,600italic' rel='stylesheet' type='text/css'>
    
    
    
    <!-- =Include bootstrap CSS File=-->
    
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
    
    
    
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" />
    
    
    
    <link href="css/style.css" rel="stylesheet" type="text/css" />
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
    
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    
    <!--[if lt IE 9]>
    
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    
    <![endif]-->
    
    </head>
    
    <body>
    
    
    
    
    
    <div class="container">
    
    <div class="row">
    
    <div class="col-md-12 text-center">
    
    <h2>Bootstrap Credit Card Form </h2>
    
    </div>
    
    </div>
    
    <div class="row">
    
    <div class="col-md-4 col-md-offset-4">
    
    <div class="credit-card-div">
    
    <div class="panel panel-default">
    
    <div class="panel-heading">
    
    
    
    <div class="row">
    
    <div class="col-md-12 col-sm-12 col-xs-12">
    
    <h5 class="text-muted"> Credit Card Number</h5>
    
    <!-- <form id="creditCardForm" class="form-horizontal">
    
    <div class="form-group">
    
    <label class="col-xs-6 control-label">Credit card number</label>
    
    <div class="col-xs-6">
    
    <input type="text" class="form-control" name="cc" />
    
    </div>
    
    </div>
    
    </form> -->
    
    
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <input type="text" class="form-control" placeholder="0000" />
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <input type="text" class="form-control" placeholder="0000" />
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <input type="text" class="form-control" placeholder="0000" />
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <input type="text" class="form-control" placeholder="0000" />
    
    </div>
    
    </div>
    
    <div class="row ">
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <span class="help-block text-muted small-font"> Expiry Month</span>
    
    <input type="text" class="form-control" placeholder="MM" />
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <span class="help-block text-muted small-font"> Expiry Year</span>
    
    <input type="text" class="form-control" placeholder="YY" />
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <span class="help-block text-muted small-font"> CCV</span>
    
    <input type="text" class="form-control" placeholder="CCV" />
    
    </div>
    
    <div class="col-md-3 col-sm-3 col-xs-3">
    
    <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAGp0lEQVR4nO1YPY8cxxF9NdOzPbN7JG/PkuiA9gVHGDBlKiVghfoFBMhA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1Ys+hf67du3M2PMLoALCP7x+yMZDYAFgNePHz9u/99gtmM7tmM7tuPHMf4DjEOG/uidi0QAAAAASUVORK5CYII=" class="img-rounded" />
    
    </div>
    
    </div>
    
    <div class="row ">
    
    <div class="col-md-12 pad-adjust">
    
    
    
    <input type="text" class="form-control" placeholder="Name On The Card" />
    
    </div>
    
    </div>
    
    <div class="row">
    
    <div class="col-md-12 pad-adjust">
    
    <div class="checkbox">
    
    <label>
    
    <input type="checkbox" checked class="text-muted"> Save details for fast payments. <a href="#">Learn More</a>
    
    </label>
    
    </div>
    
    </div>
    
    </div>
    
    <div class="row ">
    
    <div class="col-md-6 col-sm-6 col-xs-6 pad-adjust">
    
    <input type="submit" class="btn btn-danger" value="CANCEL" />
    
    </div>
    
    <div class="col-md-6 col-sm-6 col-xs-6 pad-adjust">
    
    <input type="submit" class="btn btn-warning btn-block" value="PAY NOW" />
    
    </div>
    
    </div>
    
    
    
    </div>
    
    </div>
    
    </div>
    
    <!-- CREDIT CARD DIV END -->
    
    </div>
    
    </div>
    
    </div>
    
    </body>
    
    </html>

    Below is the CSS code :-

    .credit-card-div  span {
        padding-top:10px;
            }
    .credit-card-div img {
        padding-top:30px;
    }
    .credit-card-div .small-font {
        font-size:9px;
    }
    .credit-card-div .pad-adjust {
        padding-top:10px;
    }
    .control-label{
        color: #777;
    }

    In the CSS by specifying the appropriate padding and color to the outer div i.e the credit card div I was able to create it.

    Conclusion :-

     

    With the help of above code we can easily create credit card form using Bootstrap.

    Creating Credit Card Form Using Bootstrap

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: