Free contact us form for a website can be created with the help of Html, CSS and javascript. In the last lecture, we discussed how to create a Contact me form for website in Html. Today, our main purpose is to create a contact us form in Html. So, let’s discuss something about it.
Free contact us form for website
The contact us form is used for contact with the owner or customer support of the company. It is mainly used by websites and applications, but this form is created for websites. Let’s discuss some of the features of this form.
This contacts us form has two forms and you can move across them by clicking on the button. It has a background image related to the category of the website. That’s why the background image is looking awesome because it is related to the category of the website. Then it has a vertical box that has all the content. This form has a background colour. Then it has different font colour which looks like the background colour of the box.
You might like it:
Content of free contact us form for website:
Both have different content of the form and both have different purposes.
The “say hi” form has different fields for the users to input the data into the form. Name and email of the user. Then it has a message field that is used for writing the message to the owner of the website. After that, you can click on submit button to submit your message.

It has also different fields for entering the data in the form. It has the name and email field of the user. Then it has service and budget options. This button opens by clicking on them. You can select your services and budget according to your demand. At the bottom, you can write your message according to your requirement for the website. Then you can submit all of your information by clicking a submit button.
If anyone’s field is empty and remains empty then you can’t proceed without filling all the fields of the form. So, don’t forget to fill all the fields of the form. This functionality is added by using javascript. It is known as validation of the form.
How to create a free contact us form for the website?
It can be created with the help of Html, CSS and javascript.
Source code of Html:
Create an Html file with the extension of .html and copy the below code. Then paste it to your file. Also, save it in any folder on your device.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Contact Form - Fantacy Design</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="images/icons/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="fonts/font-awesome-4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
<link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<div class="bg-contact3" style="background-image: url('images/bg-01.jpg');">
<div class="container-contact3">
<div class="wrap-contact3">
<form class="contact3-form validate-form">
<span class="contact3-form-title">
Contact Us
</span>
<div class="wrap-contact3-form-radio">
<div class="contact3-form-radio m-r-42">
<input class="input-radio3" id="radio1" type="radio" name="choice" value="say-hi" checked="checked">
<label class="label-radio3" for="radio1">
Say Hi
</label>
</div>
<div class="contact3-form-radio">
<input class="input-radio3" id="radio2" type="radio" name="choice" value="get-quote">
<label class="label-radio3" for="radio2">
Get a Quote
</label>
</div>
</div>
<div class="wrap-input3 validate-input" data-validate="Name is required">
<input class="input3" type="text" name="name" placeholder="Your Name">
<span class="focus-input3"></span>
</div>
<div class="wrap-input3 validate-input" data-validate = "Valid email is required: [email protected]">
<input class="input3" type="text" name="email" placeholder="Your Email">
<span class="focus-input3"></span>
</div>
<div class="wrap-input3 input3-select">
<div>
<select class="selection-2" name="service">
<option>Needed Services</option>
<option>eCommerce Bussiness</option>
<option>UI/UX Design</option>
<option>Online Services</option>
</select>
</div>
<span class="focus-input3"></span>
</div>
<div class="wrap-input3 input3-select">
<div>
<select class="selection-2" name="budget">
<option>Budget</option>
<option>1500 $</option>
<option>2000 $</option>
<option>3000 $</option>
</select>
</div>
<span class="focus-input3"></span>
</div>
<div class="wrap-input3 validate-input" data-validate = "Message is required">
<textarea class="input3" name="message" placeholder="Your Message"></textarea>
<span class="focus-input3"></span>
</div>
<div class="container-contact3-form-btn">
<button class="contact3-form-btn">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
<div id="dropDownSelect1"></div>
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<script src="vendor/bootstrap/js/popper.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/select2/select2.min.js"></script>
<script>
$(".selection-2").select2({
minimumResultsForSearch: 20,
dropdownParent: $('#dropDownSelect1')
});
</script>
<script src="js/main.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-23581568-13"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-23581568-13');
</script>
</body>
</html>
Source code of CSS:
Again create a CSS file and save it with the .css extension and connect it with your HTML file. Copy and paste this code into your created file.
/*//////////////////////////////////////////////////////////////////
[ FONT ]*/
@font-face {
font-family: Poppins-Regular;
src: url('../fonts/poppins/Poppins-Regular.ttf');
}
@font-face {
font-family: Poppins-Medium;
src: url('../fonts/poppins/Poppins-Medium.ttf');
}
@font-face {
font-family: Poppins-Bold;
src: url('../fonts/poppins/Poppins-Bold.ttf');
}
/*//////////////////////////////////////////////////////////////////
[ RESTYLE TAG ]*/
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body, html {
height: 100%;
font-family: Poppins-Regular, sans-serif;
}
/*---------------------------------------------*/
a {
font-family: Poppins-Regular;
font-size: 14px;
line-height: 1.7;
color: #666666;
margin: 0px;
transition: all 0.4s;
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
-moz-transition: all 0.4s;
}
a:focus {
outline: none !important;
}
a:hover {
text-decoration: none;
color: #57b846;
}
/*---------------------------------------------*/
h1,h2,h3,h4,h5,h6 {
margin: 0px;
}
p {
font-family: Poppins-Regular;
font-size: 14px;
line-height: 1.7;
color: #666666;
margin: 0px;
}
ul, li {
margin: 0px;
list-style-type: none;
}
/*---------------------------------------------*/
input {
outline: none;
border: none;
}
textarea {
outline: none;
border: none;
}
textarea:focus, input:focus {
border-color: transparent !important;
}
input::-webkit-input-placeholder { color: rgba(255,255,255,0.8);}
input:-moz-placeholder { color: rgba(255,255,255,0.8);}
input::-moz-placeholder { color: rgba(255,255,255,0.8);}
input:-ms-input-placeholder { color: rgba(255,255,255,0.8);}
textarea::-webkit-input-placeholder { color: rgba(255,255,255,0.8);}
textarea:-moz-placeholder { color: rgba(255,255,255,0.8);}
textarea::-moz-placeholder { color: rgba(255,255,255,0.8);}
textarea:-ms-input-placeholder { color: rgba(255,255,255,0.8);}
/*---------------------------------------------*/
button {
outline: none !important;
border: none;
background: transparent;
}
button:hover {
cursor: pointer;
}
iframe {
border: none !important;
}
/*//////////////////////////////////////////////////////////////////
[ Contact 2 ]*/
.bg-contact3 {
width: 100%;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
}
.container-contact3 {
width: 100%;
min-height: 100vh;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
padding: 15px;
background: rgba(105,105,105,0.2);
}
.wrap-contact3 {
width: 500px;
background: #262626;
border-radius: 10px;
overflow: hidden;
padding: 30px 55px 30px 55px;
margin-right: 250px;
box-shadow: rgba(0, 0, 0, 0.09) 0px 2px 1px, rgba(0, 0, 0, 0.09) 0px 4px 2px, rgba(0, 0, 0, 0.09) 0px 8px 4px, rgba(0, 0, 0, 0.09) 0px 16px 8px, rgba(0, 0, 0, 0.09) 0px 32px 16px;
}
/*------------------------------------------------------------------
[ ]*/
.contact3-form {
width: 100%;
}
.contact3-form-title {
display: block;
font-family: Poppins-Bold;
font-size: 39px;
color: #fff;
line-height: 1.2;
text-align: center;
text-transform: uppercase;
padding-bottom: 70px;
}
/*------------------------------------------------------------------
[ ]*/
.wrap-input3 {
width: 100%;
position: relative;
border-bottom: 2px solid rgba(255,255,255,0.24);
margin-bottom: 27px;
}
.input3 {
display: block;
width: 100%;
background: transparent;
font-family: Poppins-Regular;
font-size: 15px;
color: #fff;
line-height: 1.2;
padding: 0 5px;
}
.focus-input3 {
position: absolute;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
pointer-events: none;
}
.focus-input3::before {
content: "";
display: block;
position: absolute;
bottom: -2px;
left: 0;
width: 0;
height: 2px;
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
-moz-transition: all 0.4s;
transition: all 0.4s;
background: #fff;
}
/*---------------------------------------------*/
input.input3 {
height: 45px;
}
textarea.input3 {
min-height: 115px;
padding-top: 13px;
padding-bottom: 13px;
}
.input3:focus + .focus-input3::before {
width: 100%;
}
.has-val.input3 + .focus-input3::before {
width: 100%;
}
/*------------------------------------------------------------------
[ ]*/
.container-contact3-form-btn {
padding-top: 23px;
}
.contact3-form-btn {
font-family: Poppins-Medium;
font-size: 16px;
color: #555555;
line-height: 1.2;
text-transform: uppercase;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
justify-content: center;
align-items: center;
padding: 0 15px;
min-width: 120px;
height: 50px;
border-radius: 2px;
position: relative;
z-index: 1;
background: #1DBF73;
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
-moz-transition: all 0.4s;
transition: all 0.4s;
}
.contact3-form-btn::before {
content: "";
display: block;
position: absolute;
z-index: -1;
border-radius: 2px;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: #fff;
opacity: 1;
-webkit-transition: all 0.4s;
-o-transition: all 0.4s;
-moz-transition: all 0.4s;
transition: all 0.4s;
}
.contact3-form-btn:hover {
color: #fff;
}
.contact3-form-btn:hover:before {
opacity: 0;
}
/*------------------------------------------------------------------
[ Responsive ]*/
@media (max-width: 576px) {
.wrap-contact3 {
padding: 72px 15px 65px 15px;
}
}
/*------------------------------------------------------------------
[ Alert validate ]*/
.validate-input {
position: relative;
}
.alert-validate::before {
content: attr(data-validate);
position: absolute;
max-width: 70%;
background-color: #fff;
border: 1px solid #c80000;
border-radius: 2px;
padding: 4px 25px 4px 10px;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
right: 0px;
pointer-events: none;
font-family: Poppins-Regular;
color: #c80000;
font-size: 13px;
line-height: 1.4;
text-align: left;
visibility: hidden;
opacity: 0;
-webkit-transition: opacity 0.4s;
-o-transition: opacity 0.4s;
-moz-transition: opacity 0.4s;
transition: opacity 0.4s;
}
.alert-validate::after {
content: "\f12a";
font-family: FontAwesome;
display: block;
position: absolute;
color: #c80000;
font-size: 16px;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
right: 8px;
}
.alert-validate:hover:before {
visibility: visible;
opacity: 1;
}
@media (max-width: 992px) {
.alert-validate::before {
visibility: visible;
opacity: 1;
}
}
/*==================================================================
[ Restyle Radio ]*/
.wrap-contact3-form-radio {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
flex-wrap: wrap;
padding-bottom: 37px;
}
.input-radio3 {
display: none;
}
.label-radio3 {
display: block;
position: relative;
padding-left: 28px;
cursor: pointer;
font-family: Poppins-Medium;
font-size: 18px;
color: #fff;
line-height: 1.2;
}
.label-radio3::before {
content: "";
display: block;
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid rgba(255,255,255,0.5);
background: rgba(0,0,0,0.1);
left: 0;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
}
.label-radio3::after {
content: "";
display: block;
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
border: 6px solid transparent;
background: rgba(255,255,255,0.5);
-moz-background-clip: padding;
-webkit-background-clip: padding;
background-clip: padding-box;
left: 0;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
display: none;
}
.input-radio3:checked + .label-radio3::after {
display: block;
}
/*==================================================================
[ Input3 select ]*/
.input3-select {
display: none;
}
/*//////////////////////////////////////////////////////////////////
[ Restyle Select2 ]*/
.select2-container {
display: block;
max-width: 100% !important;
width: auto !important;
}
.select2-container .select2-selection--single {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
align-items: center;
background-color: transparent;
border: none;
height: 45px;
outline: none;
position: relative;
}
/* in select */
.select2-container .select2-selection--single .select2-selection__rendered {
font-family: Poppins-Regular;
font-size: 15px;
color: #fff;
line-height: 1.2;
padding-left: 5px ;
background-color: transparent;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 100%;
top: 50%;
transform: translateY(-50%);
right: 10px;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.select2-selection__arrow b {
display: none;
}
.select2-selection__arrow::before {
content: '';
display: block;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
border-bottom: 5px solid #e6e6e6;
margin-bottom: 2px;
}
.select2-selection__arrow::after {
content: '';
display: block;
border-right: 5px solid transparent;
border-left: 5px solid transparent;
border-top: 5px solid #e6e6e6;
}
/* dropdown option */
.select2-container--open .select2-dropdown {
z-index: 1251;
border: 1px solid #fff;
border-radius: 0px;
background-color: white;
}
.select2-container .select2-results__option[aria-selected] {
padding-top: 10px;
padding-bottom: 10px;
}
.select2-container .select2-results__option[aria-selected="true"] {
background: #1DBF73;
color: white;
}
.select2-container .select2-results__option--highlighted[aria-selected] {
background: #1DBF73;
color: white;
}
.select2-results__options {
font-family: Poppins-Regular;
font-size: 15px;
color: #555555;
line-height: 1.2;
}
.select2-search--dropdown .select2-search__field {
border: 1px solid #aaa;
outline: none;
font-family: Poppins-Regular;
font-size: 15px;
color: #555555;
line-height: 1.2;
}
Source code of javascript:
Once again create a javascript file and save it with the extension of .js and connect it with an Html file. Copy this js code and paste it to your file.
(function ($) {
"use strict";
/*==================================================================
[ Focus Contact2 ]*/
$('.input3').each(function(){
$(this).on('blur', function(){
if($(this).val().trim() != "") {
$(this).addClass('has-val');
}
else {
$(this).removeClass('has-val');
}
})
})
/*==================================================================
[ Chose Radio ]*/
$("#radio1").on('change', function(){
if ($(this).is(":checked")) {
$('.input3-select').slideUp(300);
}
});
$("#radio2").on('change', function(){
if ($(this).is(":checked")) {
$('.input3-select').slideDown(300);
}
});
/*==================================================================
[ Validate ]*/
var name = $('.validate-input input[name="name"]');
var email = $('.validate-input input[name="email"]');
var message = $('.validate-input textarea[name="message"]');
$('.validate-form').on('submit',function(){
var check = true;
if($(name).val().trim() == ''){
showValidate(name);
check=false;
}
if($(email).val().trim().match(/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{1,5}|[0-9]{1,3})(\]?)$/) == null) {
showValidate(email);
check=false;
}
if($(message).val().trim() == ''){
showValidate(message);
check=false;
}
return check;
});
$('.validate-form .input3').each(function(){
$(this).focus(function(){
hideValidate(this);
});
});
function showValidate(input) {
var thisAlert = $(input).parent();
$(thisAlert).addClass('alert-validate');
}
function hideValidate(input) {
var thisAlert = $(input).parent();
$(thisAlert).removeClass('alert-validate');
}
})(jQuery);
You have to use all these languages if you want to create a responsive and validation form for your website. But if you want to make it responsive then just use Html. It will also work but there will not be any design of the form.
In this way, you can create a contact us form. If you can’t make it by following our methods then download the source code of the file and then run it.
Thanks for reading this post and don’t forget to follow and share.