Responsive Checkout Form using HTML CSS

Responsive Checkout Form using HTML CSS (Free Code)

Responsive Checkout Form using HTML CSS

In this article, you will learn how to create a Responsive Checkout Form using HTML and CSS. Earlier I shared with you the tutorials of different types of checkout form CSS. This is the first time I have created a Responsive Checkout Form tutorial using HTML and CSS.

I use payment forms in different places. This type of check-out form is also used for a variety of e-commerce platforms, online products, or service platforms. This Responsive Form I created only with HTML and CSS. 

Everything contained in a professional payment form is provided here. Although it is not functional as it is only designed by HTML CSS here.

Responsive Checkout Form

Checkout form HTML CSS is fully responsive so you can use it directly in any of your projects. Below I have given a preview that will help you to know how it works (Responsive Checkout Form using HTML CSS).

You can use the download button below the article to get the required source code.

See the Pen
CHECKOUT FORM HTML CSS
by Foolish Developer (@foolishdevweb)
on CodePen.

I made a box on the webpage as you saw above. I used black as the background color of the webpage. The background of the entire checkout page has been whitewashed. First I used a heading with blue in the background. 

There are four inputs here. To input the first input box card number, to input the name of the second input box cardholder. Then there are two input boxes to input Expire date and CVC code. There is a button at the end of all that will submit this information.

How To Create a Checkout Form with CSS

Below I have shown a step-by-step tutorial on how to create a Responsive Checkout Form. If you only want the source code, you can use the download button below the article.

Step 1: Basic structure of checkout form

I have created the basic structure of this check-out form and designed the webpage using the following HTML codes. Its max-width of background 500px and height will depend on the amount of content.

<div class=”container”>
  <div class=”title”>Checkout Form</div>
   <div class=”input-form”>
   </div>
</div>
*{
margin: 0;
padding: 0;
box-sizing: border-box;
outline: none;
font-family: ‘Open Sans’, sans-serif;
}
body{
background: rgb(12, 18, 27);
background-size: cover;
width: 100%;
height: 100vh;
font-size: 16px;
}
.container{
max-width: 500px;
height: auto;
margin: 60px auto;
background: #fff;
padding: 20px 40px 30px;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
border-top: 5px solid #5f6c7d;
}
Basic structure of checkout form

Step 2: Design the title in the form

A title has been added using the following CSS code. The h1 tag has been used to create this heading.

.title{
color: #d1d9e3;
font-size: 1.8em;
background: rgb(15, 72, 156);
text-align: center;
text-transform: uppercase;
font-weight: 900;
margin-top: -20px;
margin: -20px -40px;
margin-bottom: 30px;
}
.input-form{
margin-bottom: 20px;
}
Design the title in the form

Step 3: 1st and 2nd input boxes of Checkout Form

I created the first two input boxes using the following HTML codes. The first input box to input the card number and the second input box to input the card holder’s name. Different conditions and limits have been used in the input box.

<div class=”section-1″>
  <div class=”items”>
    <label class=”label”>card number</label>
    <input type=”text” class=”input” maxlength=”16″ data-mask=”0000 0000 0000 0000″placeholder=”1234 1234 1234 1234″>
   </div>
</div>
<div class=”section-2″>
  <div class=”items”>
      <label class=”label”>card holder</label>
      <input type=”text” class=”input” placeholder=”Coding Market”>
  </div>
</div>

I have designed the above two input boxes using the following CSS.

.input-form .label{
  display: block;
  font-size: 1em;
  color: #212121;
  text-transform: capitalize;
  margin-bottom: 8px;
}
.input-form .items{
margin-bottom: 20px;
}
.section-1 .items .input,
.section-2 .items .input,
.section-3 .items .input{
  background: transparent;
  border: 2px solid #BDBDBD;
  width: 100%;
  padding: 10px;
  font-size: 1em;
  color: #212121;
  border-radius: 3px;
}
1st and 2nd input boxes of Checkout Form

Step 4: 3rd and 4th input boxes of the checkout form

The 3rd and 4th input boxes have been created using the following HTML codes. If you watch the demo you will understand that there is an icon instead of inputting CVC code. 

When you hover or click on that icon, a small image will appear in the form of a pop-up. That image will show you where to find this CVC code on your card.

<div class=”section-3″>
  <div class=”items”>
     <label class=”label”>Expire date</label>
     <input type=”text” class=”input” data-mask=”00 / 00″ placeholder=”MM / YY”>
  </div>
  <div class=”items”>
    <div class=”cvc”>
      <label class=”label”>cvc code</label>
       <div class=”tooltip”>?
          <div class=”cvc-img”><img src=”https://i.imgur.com/r8oXtry.png” alt=””></div>
       </div>
    </div>
    <input type=”text” class=”input” data-mask=”0000″ placeholder=”0000″>
  </div>
</div>

Using the CSS below, the two input spaces have been slightly designed.

.input-form .section-3{
display: flex;
justify-content: space-between;
}
.input-form .section-3 .items{
 width: 48%;
}

Step 5: The tooltip is designed by CSS

The location of the popup box has been designed using the following codes.

.cvc{
display: flex;
justify-content: space-between;
position: relative;
transition: all 0.3s ease;
}
.cvc .tooltip{
color: #115e9f;
border: 2px solid #1d56e7;
border-radius: 50%;
width: 25px;
height: 25px;
text-align:center;
cursor: pointer;
}
3rd and 4th input boxes of the checkout form

Step 6: The tooltip is activated by CSS

The following codes have been used to design the image in that pop-up box. I have already added the image to the HTML code.

.cvc .cvc-img{
position: absolute;
top: -300%;
right: 0;
background: #5f6c7d;
padding: 12px;
border-radius: 5px;
display: none;
}
.cvc .cvc-img img{
width: 100px;
height: auto;
display: block;
}
.cvc:hover .cvc-img{
display: block;
}
The tooltip is activated by CSS

Step 7: Create a payment form button

The submit button has been designed using the following HTML and CSS code. The background color of the button is blue and the text color is white.

<div class=”btn”>proceed</div
.btn{
background: #2d6fe7;
color: #fff;
font-size: 1.25em;
padding: 10px 0;
text-align: center;
text-transform: uppercase;
border-radius: 5px;
cursor: pointer;
font-weight: bold;
letter-spacing: 2px;
}
Create a payment form button

Step 8: Make Checkout Form Responsive with CSS

Above we have designed this completely (Responsive Checkout Form using HTML CSS). But now not a Responsive. You need to use some amount of CSS code to make it responsive.

@media screen and (max-width: 460px){
.input-form .section-3{
  flex-direction: column;
}
.input-form .section-3 .items{
   width: 100%;
}
.input-form .items{
  margin-bottom: 10px;
}
.input-form{
  margin-bottom: 15px;
}
.title{
  font-size: 1.5em;
  margin-bottom: 15px;
}
}
payment form html css

Hopefully, you have learned from the above tutorial how this Responsive Checkout Form has been created using HTML and CSS. If there is any problem then you can definitely let me know by commenting.