📝 Create a Simple HTML Form with Name, Email, and Password Fields
Forms are an essential part of web development. Whether you're collecting user information, signing up users, or handling contact details, HTML forms are the building blocks.
In this guide, we’ll create a simple HTML form with three fields:
-
Name
-
Email
-
Password
Let’s break it down step-by-step in easy words so that even a beginner can understand.
🔧 Step 1: Basic Structure of an HTML Page
Before we create a form, we need to set up a basic HTML page.
<!DOCTYPE html>
<html>
<head>
<title>Simple HTML Form</title>
</head>
<body>
<!-- Our form will go here -->
</body>
</html>
📝 Explanation:
-
<!DOCTYPE html>
: Declares this file as an HTML5 document. -
<html>
: The root element of the HTML document. -
<head>
: Contains metadata like the page title. -
<body>
: Everything visible on the webpage goes inside the body.
🧾 Step 2: Create the Form Tag
Now let’s add the form inside the <body>
.
<form action="#" method="post">
<!-- Form elements will go here -->
</form>
📝 Explanation:
-
<form>
: This tag starts the form. -
action="#"
: This is where the form data will be sent. For now,#
means we are not sending it anywhere. -
method="post"
: This tells the browser to send the form data securely (commonly used for login, signup, etc.).