Step 1: Set up your HTML file Create an HTML file with the basic structure and add a form element. Inside the form element, add input fields for the credit card number, expiry date, CVV number, name on card, and amount to be paid.
Step 2: Add CSS styling<!DOCTYPE html> <html> <head> <title>Payment Gateway Form</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <form> <label for="cardNumber">Card Number:</label> <input type="text" id="cardNumber" name="cardNumber"><br><br> <label for="expiryDate">Expiry Date:</label> <input type="text" id="expiryDate" name="expiryDate"><br><br> <label for="cvv">CVV Number:</label> <input type="text" id="cvv" name="cvv"><br><br> <label for="nameOnCard">Name on Card:</label> <input type="text" id="nameOnCard" name="nameOnCard"><br><br> <label for="amount">Amount:</label> <input type="text" id="amount" name="amount"><br><br> <input type="submit" value="Submit"> </form> </div> </body> </html>
To make the form responsive and visually appealing, add CSS styling. You can use flexbox to create a responsive layout and add styles to the input fields and submit button.
.container {
max-width: 600px;
margin: auto;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
background-color: #f2f2f2;
}
form {
display: flex;
flex-direction: column;
align-items: center;
}
label {
font-weight: bold;
}
input[type="text"] {
padding: 10px;
margin: 10px;
border-radius: 5px;
border: none;
box-shadow: 0px 0px 5px #888888;
width: 100%;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
margin-top: 20px;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
Step 3: Test and modify as needed Test the form on different devices and screen sizes to ensure that it is responsive and easy to use. Make modifications as needed to improve the user experience.
That's it! You now have a responsive payment gateway form created using HTML and CSS.
Social Plugin