Build a Simple Contact Form Page with HTMLNew
• Updated 5/26/2026 • HTMLFormsWeb DevelopmentBeginner
Challenge Goal
In this beginner-friendly HTML coding challenge, you will build a complete Contact Us page using only HTML5. Your page will include a short introduction and an accessible contact form that collects a user's name, email address, and message.
What You Will Build
You will create a file named contact.html that contains a full HTML document with a working form structure. The form will not actually send data to a real server, but it will demonstrate the correct HTML markup used in real contact pages.
Concept Overview
HTML forms allow users to enter and submit information on a website. They are commonly used for contact pages, login pages, registration forms, surveys, search boxes, and checkout pages.
In this challenge, you will practice:
- Creating a complete HTML5 document structure.
- Using the
<form>element. - Adding text, email, and message fields.
- Connecting
<label>elements to form fields for accessibility. - Using the
requiredattribute for basic browser validation. - Writing clean, beginner-friendly, semantic HTML.
Example Form Structure
Here is a small example of how a contact form can be structured:
<form action="#" method="post">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" rows="5" required></textarea>
<button type="submit">Send Message</button>
</form>
Coding Challenge
Create a complete HTML page named contact.html. Your goal is to build a simple, accessible contact form page using only HTML. Do not use CSS or JavaScript for the main challenge.
Requirements
- Create a file named
contact.html. - Use the
<!DOCTYPE html>declaration. - Include proper
<html>,<head>, and<body>sections. - Add
lang="en"to the opening<html>tag. - Inside the
<head>, include a UTF-8 charset meta tag. - Set the page title to
Contact Us. - Add a main heading using
<h1>with the textContact Us. - Add a short paragraph inviting users to send a message.
- Create a form with
action="#"andmethod="post". - Add a required name field using
<input type="text">. - Add a required email field using
<input type="email">. - Add a required message field using
<textarea>. - Use a
<label>for every field. - Make sure each label's
forvalue matches the related field'sid. - Add a submit button with the text
Send Message.
Input and Output Expectations
Input
The user should be able to enter:
- Their name.
- Their email address.
- Their message.
Output
When the user clicks the submit button, the browser should check that all required fields are filled in. Because this challenge uses action="#", the form does not submit to a real server.
Constraints
- Use only HTML5.
- Do not use CSS for the main challenge.
- Do not use JavaScript.
- Do not connect the form to a backend server.
- The page should be valid HTML.
- The form should be accessible for screen readers.
Hints
- Use
<input type="email">for the email field so the browser can validate email format. - The
<textarea>element does not use atypeattribute. - The
nameattribute identifies the data when a form is submitted. - The
idattribute connects a field to its label. - The
requiredattribute tells the browser that a field must be completed. - You can use
<br>to separate fields for this beginner challenge, but CSS is usually better for layout in real projects.
Starter Code
Use this starter code and complete the missing form fields:
<!-- Save this file as contact.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact Us</title>
</head>
<body>
<h1>Contact Us</h1>
<p>Write a short introduction here.</p>
<form action="#" method="post">
<!-- Add the name field here -->
<!-- Add the email field here -->
<!-- Add the message field here -->
<button type="submit">Send Message</button>
</form>
</body>
</html>
Solution Walkthrough
Step 1: Create the HTML document
Start with the standard HTML5 structure. The <!DOCTYPE html> declaration tells the browser to use HTML5.
Step 2: Add page metadata
Inside the <head>, add <meta charset="UTF-8"> so the page supports common characters. Then add a clear page title using <title>.
Step 3: Add the page content
Inside the <body>, add a main heading and a short paragraph explaining what the form is for.
Step 4: Build the form
Create a <form> with action="#" and method="post". Then add labeled fields for name, email, and message.
Step 5: Improve accessibility
Every form field should have a label. The label's for attribute must match the field's id. This helps users who rely on assistive technologies.
Final Solution
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact Us</title>
</head>
<body>
<h1>Contact Us</h1>
<p>Have a question or feedback? Fill out the form below and we will get back to you soon.</p>
<form action="#" method="post">
<label for="name">Name:</label><br>
<input type="text" id="name" name="name" required><br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br><br>
<label for="message">Message:</label><br>
<textarea id="message" name="message" rows="5" required></textarea><br><br>
<button type="submit">Send Message</button>
</form>
</body>
</html>
Stretch Goals
- Add placeholder text to each field, such as
Enter your name. - Add a
<fieldset>and<legend>to group the form fields. - Add a phone number field using
<input type="tel">. - Add a subject field using
<input type="text">. - Add a dropdown using
<select>so users can choose a reason for contacting you. - After completing the HTML-only version, create a separate CSS file to style the form.
Quick Checklist
- Does your page have a valid HTML5 document structure?
- Does your form include name, email, and message fields?
- Does every field have a matching label?
- Are all fields marked as required?
- Does your submit button say
Send Message?

