Create Your Own "Contact Us" Page in Minutes
Want to add a contact page to your website so your viewers can reach you easily? I’ve got you covered with this simple HTML and CSS code. It’s beginner-friendly, looks great, and even works on phones! Below, I’ll share the full code with explanations—plus instructions to make it functional.
This code let Viewers to send you Email. This will improve reachability of viewers and collect their feedback for improvement. let's start with us
The Code
Copy this into a file called contact.html:
<html> <head> <title>Contact Us - YourBlogName</title> <style> /* Unique container class to avoid theme conflicts */ .custom-contact-container { max-width: 800px; /* Limits the width */ margin: 20px auto; /* Centers it */ padding: 15px; /* Inner space */ } /* Scope all styles to the custom container */ .custom-contact-container h1 { text-align: center; /* Center the title */ margin-bottom: 20px; /* Space below */ font-size: 28px !important; /* Force size */ } .custom-contact-container p { text-align: center; /* Center text */ margin-bottom: 30px; /* Space below */ font-size: 16px !important; /* Force size */ } .custom-contact-container .contact-form { display: flex; /* Stack items */ flex-direction: column; /* Vertical layout */ gap: 15px; /* Space between elements */ } .custom-contact-container .contact-form label { font-weight: bold; /* Bold labels */ margin-bottom: 5px; /* Space below */ } .custom-contact-container .contact-form input, .custom-contact-container .contact-form textarea { width: 100% !important; /* Force full width */ padding: 10px; /* Inner space */ border: 1px solid #ccc !important; /* Force border */ border-radius: 5px; /* Rounded corners */ font-size: 16px !important; /* Force text size */ box-sizing: border-box; /* Fix padding */ } .custom-contact-container .contact-form textarea { height: 150px !important; /* Force height */ resize: vertical; /* Resizable vertically */ } .custom-contact-container .contact-form button { background: #007bff !important; /* Force blue */ color: #fff !important; /* Force white text */ padding: 12px; /* Inner space */ border: none !important; /* No border */ border-radius: 5px; /* Rounded corners */ font-size: 16px !important; /* Force text size */ cursor: pointer; /* Hand on hover */ } .custom-contact-container .contact-form button:hover { background: #0056b3 !important; /* Darker blue on hover */ } /* Responsive adjustments scoped to container */ @media (max-width: 600px) { .custom-contact-container { padding: 10px; /* Less padding on small screens */ } .custom-contact-container h1 { font-size: 24px !important; /* Smaller title */ } .custom-contact-container .contact-form input, .custom-contact-container .contact-form textarea, .custom-contact-container .contact-form button { font-size: 14px !important; /* Smaller text */ } } </style> </head> <body> <!-- Unique container class to isolate styles --> <div class="custom-contact-container"> <h1>Contact Us - YourBlogName</h1> <!-- Page title --> <p>Have a question or feedback? Reach out to us below!</p> <!-- Intro text --> <!-- Form with isolated class --> <form action="https://formspree.io/f/your-form-id" class="contact-form" method="POST"> <!-- Name field --> <label for="name">Name</label> <input id="name" name="name" placeholder="Your Name" required="" type="text" /> <!-- Email field --> <label for="email">Email</label> <input id="email" name="email" placeholder="Your Email" required="" type="email" /> <!-- Message field --> <label for="message">Message</label> <textarea id="message" name="message" placeholder="Your Message" required=""></textarea> <!-- Submit button --> <button type="submit">Send Message</button> </form> </div> </body> </html>
How to Use It
- Customize It:
- Replace YourBlogName with your site’s name (appears in the title and heading).
- Change colors like #007bff (button blue) to match your style—try #ff5733 for orange, for example.
- Make It Work:
- Sign up at formspree.io (free for up to 50 submissions/month).
- Create a form and get your unique URL (e.g., https://formspree.io/f/xabc1234).
- Replace https://formspree.io/f/your-form-id in the <form action="..."> with your URL.
- When someone submits the form, you’ll get an email with their message!
- Add It to Your Blogger Post or WordPress Website:
- For Blogger:
- Log in to Blogger.
- Go to "Pages" in the left menu and click "New Page."
- Give it a title like "Contact Us."
- Switch to "HTML view" (top right corner, next to "Compose view").
- Paste the entire code from above into the editor.
- Click "Publish." Now your contact form is live as a page on your blog!
- Add a link to it in your blog’s menu (Layout > Add Gadget > Link List).
- For WordPress:
- Log in to your WordPress dashboard.
- Go to "Pages" > "Add New."
- Title it "Contact Us."
- If using the Block Editor (Gutenberg), add a "Custom HTML" block and paste the code.
- If using the Classic Editor, switch to "Text" mode (not "Visual") and paste the code.
- Click "Publish." Your contact page is ready!
- Add it to your menu (Appearance > Menus > Add the page > Save).
Why This Works
- Theme-Safe: The .custom-contact-container class and !important tags keep your styles isolated from Blogger’s theme.
- Simple: Just HTML and CSS—no complex coding.
- Responsive: Looks great on all devices.
- Functional: Formspree handles submissions.
Try it out and let your viewers reach you easily. Questions? Drop them below!
Comments
Post a Comment