- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a form with custom buttons in HTML
Overview
Buttons are the components in HTML which perform a certain action when clicked. Various buttons perform various actions. The HTML has some predefined buttons with a certain type of action. In a HTML form when the <button> tag is used by default, the simple button inside the form tag is of type submit. So when you click on a button inside the form tag it will submit the form on your desired path and depends on the GET and POST request. The submit location is defined in the action attribute of the form. The HTML form by default is of method type GET.
When the button is clicked if the form contains the method type GET then the data written inside the input tags are concatenated with the URL of the page. But this is not a secure way for a request as the user credentials may be disclosed in this case. So it is preferred to use the POST type of method when submitting the user credentials for security purposes.
Syntax
The syntax to create a form is −
<form action=""> </form>
The syntax to create a button is −
<button> </button>
Algorithm
Step 1 − Create a HTML boilerplate in the code editor.
Step 2 − As we had used the font awesome reset icon in our button, so we had to link the font awesome CDN link to the head tag of the code.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css" integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bS uGGKHEyjSoQ1zVisanQ==" crossorigin="anonymous" referrerpolicy="no-referrer" />
Step 3 − Create a HTML form using the