This HTML & CSS code snippet helps you to create a simple and responsive Contact Us page design. It uses CSS flex property to create a layout with a contact form and contact information. The contact form is styled to match the overall design of the page, and it includes validation to ensure that visitors enter all of the required information.
The contact form includes fields for the visitor’s name, email address, and message. The form also includes validation to ensure that the visitor enters all of the required information.
How to Create Contact Us Page Design In HTML and CSS
1. First of all, add the Font Awesome script to your HTML file’s head section to enable icons.
<script src="https://kit.fontawesome.com/c32adfdcda.js" crossorigin="anonymous"></script>
2. Copy the following HTML code and paste it into your HTML file where you want the contact page. Modify the content within the HTML code to reflect your organization’s details (e.g., company name, address, phone number, and email).
<section> <div class="section-header"> <div class="container"> <h2>Contact Us</h2> <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p> </div> </div> <div class="container"> <div class="row"> <div class="contact-info"> <div class="contact-info-item"> <div class="contact-info-icon"> <i class="fas fa-home"></i> </div> <div class="contact-info-content"> <h4>Address</h4> <p>4671 Sugar Camp Road,<br/> Owatonna, Minnesota, <br/>55060</p> </div> </div> <div class="contact-info-item"> <div class="contact-info-icon"> <i class="fas fa-phone"></i> </div> <div class="contact-info-content"> <h4>Phone</h4> <p>571-457-2321</p> </div> </div> <div class="contact-info-item"> <div class="contact-info-icon"> <i class="fas fa-envelope"></i> </div> <div class="contact-info-content"> <h4>Email</h4> <p>[email protected]</p> </div> </div> </div> <div class="contact-form"> <form action="" id="contact-form"> <h2>Send Message</h2> <div class="input-box"> <input type="text" required="true" name=""> <span>Full Name</span> </div> <div class="input-box"> <input type="email" required="true" name=""> <span>Email</span> </div> <div class="input-box"> <textarea required="true" name=""></textarea> <span>Type your Message...</span> </div> <div class="input-box"> <input type="submit" value="Send" name=""> </div> </form> </div> </div> </div> </section>
3. Now, copy the CSS code and add it to your website’s CSS file or within a <style>
tag in the HTML file. Replace the background image URL in the CSS code with an image of your choice, maintaining the “background-size” and “background-position” properties for optimal display.
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap'); * { padding: 0; margin: 0; box-sizing: border-box; font-family: 'Poppins', sans-serif; } body { min-height: 100vh; width: 100%; display: flex; justify-content: center; align-items: center; background-image: url(https://images.pexels.com/photos/325185/pexels-photo-325185.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940) !important; background-size: cover; background-position: center; position: relative; } body::after { content: ""; position: absolute; top: 0; left: 0; height: 100%; width: 100%; background-color: rgba(0,0,0,0.8); } section { position: relative; z-index: 3; padding-top: 50px; padding-bottom: 50px; } .container { max-width: 1080px; margin-left: auto; margin-right: auto; padding-left: 20px; padding-right: 20px; } .section-header { margin-bottom: 50px; text-align: center; } .section-header h2 { color: #FFF; font-weight: bold; font-size: 3em; margin-bottom: 20px; } .section-header p { color: #FFF; } .row { display: flex; flwx-wrap: wrap; align-items: center; justify-content: space-between; } .contact-info { width: 50%; } .contact-info-item { display: flex; margin-bottom: 30px; } .contact-info-icon { height: 70px; width: 70px; background-color: #fff; text-align: center; border-radius: 50%; } .contact-info-icon i { font-size: 30px; line-height: 70px; } .contact-info-content { margin-left: 20px; } .contact-info-content h4 { color: #1da9c0; font-size: 1.4em; margin-bottom: 5px; } .contact-info-content p { color: #FFF; font-size: 1em; } .contact-form { background-color: #fff; padding: 40px; width: 45%; padding-bottom: 20px; padding-top: 20px; } .contact-form h2 { font-weight: bold; font-size: 2em; margin-bottom: 10px; color: #333; } .contact-form .input-box { position: relative; width: 100%; margin-top: 10px; } .contact-form .input-box input, .contact-form .input-box textarea{ width: 100%; padding: 5px 0; font-size: 16px; margin: 10px 0; border: none; border-bottom: 2px solid #333; outline: none; resize: none; } .contact-form .input-box span { position: absolute; left: 0; padding: 5px 0; font-size: 16px; margin: 10px 0; pointer-events: none; transition: 0.5s; color: #666; } .contact-form .input-box input:focus ~ span, .contact-form .input-box textarea:focus ~ span{ color: #e91e63; font-size: 12px; transform: translateY(-20px); } .contact-form .input-box input[type="submit"] { width: 100%; background: #00bcd4; color: #FFF; border: none; cursor: pointer; padding: 10px; font-size: 18px; border: 1px solid #00bcd4; transition: 0.5s; } .contact-form .input-box input[type="submit"]:hover { background: #FFF; color: #00bcd4; } @media (max-width: 991px) { section { padding-top: 50px; padding-bottom: 50px; } .row { flex-direction: column; } .contact-info { margin-bottom: 40px; width: 100%; } .contact-form { width: 100%; } }
Customize the design further by adjusting colors, fonts, or layout styles in the CSS code to align with your website’s theme.
That’s all! hopefully, you have successfully created the Contact Us Page design using this HTML and CSS code. If you have any questions or suggestions, feel free to comment below.
Similar Code Snippets:
I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences.
I truly enjoy what I’m doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.
Creating the contact form is one thing, another thing that is missing in this tutorial is “Where do the sent emails go to???” How do we receive and read the emails sent to us?????