Build a Contact Us Page Using HTML Forms, Anchor Tag () and Iframe (With Source Code)
Introduction
In modern web development, creating a Contact Us page is one of the most important features of any website. It allows users to connect with us, send queries, provide feedback, and interact with our platform.
As developers, we often combine multiple HTML concepts to build real-world applications. In this tutorial, we will learn how to create a fully functional Contact Us page using:
- HTML forms for collecting user input
- Anchor (
<a>) tag for navigation and communication - Iframe (
<iframe>) to embed external content like maps
By the end of this guide, we will have a clean, responsive, and practical Contact Us page that we can use in real projects.
In modern web development, creating a Contact Us page is one of the most important features of any website. It allows users to connect with us, send queries, provide feedback, and interact with our platform.
As developers, we often combine multiple HTML concepts to build real-world applications. In this tutorial, we will learn how to create a fully functional Contact Us page using:
- HTML forms for collecting user input
- Anchor (
<a>) tag for navigation and communication - Iframe (
<iframe>) to embed external content like maps
By the end of this guide, we will have a clean, responsive, and practical Contact Us page that we can use in real projects.
Why Do We Need a Contact Us Page?
Before we start coding, let’s understand the importance of a Contact page.
A Contact Us page helps us:
- Provide users with a way to reach us
- Build trust and credibility
- Collect feedback and inquiries
- Improve user engagement
It is a must-have feature for business websites, portfolios, blogs, and applications.
Using Anchor Tag (<a>) in Contact Page
The anchor tag is used to create clickable links. In a Contact Us page, we commonly use it for:
-
Email links
-
Social media links
-
External navigation
Example :
<a href="mailto:abc@gmail.com">Send Email</a>
<a href="https://www.linkedin.com" target="_blank"> LinkedIn</a>
Before we start coding, let’s understand the importance of a Contact page.
A Contact Us page helps us:
- Provide users with a way to reach us
- Build trust and credibility
- Collect feedback and inquiries
- Improve user engagement
It is a must-have feature for business websites, portfolios, blogs, and applications.
Using Anchor Tag (<a>) in Contact Page
The anchor tag is used to create clickable links. In a Contact Us page, we commonly use it for:
- Email links
- Social media links
- External navigation
Explanation
-
mailto: allows users to send emails directly
-
target="_blank" opens links in a new tab
Using anchor tags improves navigation and user interaction.
-
mailto:allows users to send emails directly -
target="_blank"opens links in a new tab
Using anchor tags improves navigation and user interaction.
Using HTML Forms for User Input
Forms are the core part of a Contact Us page. They allow users to submit their information such as:
-
Name
-
Email
-
Message
Basic Form Example :
Forms are the core part of a Contact Us page. They allow users to submit their information such as:
- Name
- Message
<form> <input type="text" placeholder="Enter your name" /> <input type="email" placeholder="Enter your email" /> <textarea placeholder="Your message"></textarea> <button>Submit</button></form>
Best Practices for Forms
To create effective forms, we should:
-
Use proper labels
-
Validate input fields
-
Keep the form simple
-
Provide clear placeholders
Forms help us collect structured data and connect frontend with backend systems.
Using Iframe (<iframe>) in Contact Page
An iframe allows us to embed external content inside our webpage. In a Contact Us page, it is commonly used to display:
-
Google Maps
-
Location details
-
External resources
To create effective forms, we should:
- Use proper labels
- Validate input fields
- Keep the form simple
- Provide clear placeholders
Forms help us collect structured data and connect frontend with backend systems.
Using Iframe (<iframe>) in Contact Page
An iframe allows us to embed external content inside our webpage. In a Contact Us page, it is commonly used to display:
- Google Maps
- Location details
- External resources
Example:
<iframe src="https://www.google.com/maps/embed?..." width="100%" height="450" style="border:0;" loading="lazy"></iframe>
Why Use Iframe?
- Shows location visually
- Improves user experience
- Helps users find directions easily
- Shows location visually
- Improves user experience
- Helps users find directions easily
Complete Contact Us Page Source Code
HTML Code :
CSS Code :
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap");body { margin: 0; font-family: "Poppins", sans-serif; background: linear-gradient(to right, #f1f1f1, #f1f3f4);}.contact-title { font-size: 25px; font-weight: 600; margin-bottom: 20px;}.contact-container { min-height: 100vh; padding: 60px 100px;}
.contact-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 30px; background-color: #fff; padding: 50px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05); margin-bottom: 60px;}.contact-left { display: flex; align-items: center; justify-content: center;}.contact-left div { font-size: 18px; margin-bottom: 15px;}
.contact-left a { color: #0d6efd; text-decoration: none;}
.contact-left a:hover { text-decoration: underline;}.contact-left i { font-size: 18px; margin-right: 10px; cursor: pointer; color: #555; transition: 0.3s;}
.contact-left i:hover { color: #0d6efd;}
.contact-right form div { margin-bottom: 15px;}
label { font-size: 14px; color: #333; margin-bottom: 5px; display: inline-block;}
input,textarea { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; outline: none; font-size: 14px; transition: 0.3s;}
input:focus,textarea:focus { border-color: #0d6efd;}
button { background-color: #0d6efd; color: #fff; border: none; padding: 10px 18px; border-radius: 6px; cursor: pointer; transition: 0.3s;}
button:hover { background-color: #0b5ed7;}
Output :
How This Project Works
In this project, we combine three important concepts:
- Forms → Collect user input
- Anchor tags → Provide communication links
- Iframe → Display location
This creates a complete and interactive Contact Us page.
Best Practices for Contact Page Design
To make our Contact page more effective, we should:
- Keep the layout clean and simple
- Use clear labels and placeholders
- Ensure mobile responsiveness
- Add social media links
- Include location (map)
Conclusion
In this project, we successfully built a real-world Contact Us page using HTML forms, anchor tags, and iframes.
We learned how to:
- Collect user input using forms
-
Create links using
<a>tag -
Embed maps using
<iframe>
These concepts are essential for building modern and interactive websites.
๐ Explore Full Series
Continue learning step by step from our complete roadmap click the link below:
๐ HTML & CSS Learning Series
What’s Coming Up Next?
In the next part of this series, we will explore CSS positioning concepts such as static, relative, absolute, and fixed positioning.
We will learn how to control layout and position elements effectively in real-world projects.
Follow for More
If you’re interested in learning HTML, CSS, React, and MERN Stack,
stay connected for more beginner-friendly tutorials and real-world projects.


Comments
Post a Comment