Quick Introduction

Yesterday I was looking for design inspiration and I found out an awesome site named ‘frontendmentors.io‘ which gives you different design challenges based on your skill-set.

There I found an awesome yet simple coming soon page challenge. I thought let’s give it a try and solve it.

Code challenge page: visit

Here’s what we are making today

coming soon page
coming soon page

Html

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="icon" type="image/png" sizes="32x32" href="./images/favicon-32x32.png" />
    <link rel="stylesheet" href="style.css" />
    <title>Frontend Mentor | Base Apparel coming soon page</title>
</head>

<body>
    <div class="container">
        <div class="left">
            <div class="inner-container">
                <img class="logo" src="./images/logo.svg" alt="logo" />
                <img class="bg-mobile" src="./images/hero-mobile.jpg" alt="background mobile" />
                <h1>
                    <span>We're</span>
                    <br />
                    coming
                    <br />
                    soon
                </h1>
                <p>
                    Hello fellow shoppers! We're currently building our new fashion
                    store. Add your email below to stay up-to-date with announcements
                    and our launch deals.
                </p>
                <form id="form">
                    <input id="email" type="email" placeholder="Enter Your Email Address" />
                    <img class="error-icon" src="./images/icon-error.svg" alt="error" />
                    <button>
                        <img src="./images/icon-arrow.svg" alt="arrow" />
                    </button>
                    <small>Please provide a valid email</small>
                </form>
            </div>
        </div>
        <div class="right bg-image"></div>
    </div>
    <script src="script.js"></script>
</body>

</html>

CSS

@import url('https://fonts.googleapis.com/css?family=Josefin+Sans:200,400,600&display=swap');
* {
	box-sizing: border-box;
}

body {
	background-image: linear-gradient(
		135deg,
		hsl(0, 0%, 100%),
		hsl(0, 100%, 98%)
	);
	font-family: 'Josefin Sans', sans-serif;
	margin: 0;
}

.container {
	display: flex;
	min-height: 100vh;
}

.left {
	background-image: url('./images/bg-pattern-desktop.svg');
	background-size: cover;
	background-position: center center;
	padding: 0 40px 40px;
	width: 60%;
}

.inner-container {
	max-width: 450px;
	margin: auto;
}

.right {
	width: 40%;
}

.bg-image {
	background-image: url('./images/hero-desktop.jpg');
	background-size: cover;
	background-position: center center;
}

.logo {
	margin: 60px 0;
	width: 200px;
}

.bg-mobile {
	display: none;
}

h1 {
	color: hsl(0, 6%, 24%);
	font-size: 60px;
	letter-spacing: 10px;
	line-height: 1.1;
	margin-bottom: 0;
	transform: translateX(-100%);
	text-transform: uppercase;
	animation: comeinleft 0.5s ease forwards;
}

h1 span {
	color: hsl(0, 36%, 70%);
	font-weight: 200;
}

p {
	color: hsl(0, 36%, 70%);
	line-height: 26px;
	margin: 30px 0;
	transform: translateX(100%);
	opacity: 0;
	animation: comeinright 0.5s ease forwards;
}

form {
	position: relative;
	transform: translateX(-100%);
	animation: comeinleft 0.5s ease forwards;
}

input {
	background-color: transparent;
	border: 1px solid hsl(0, 36%, 70%);
	border-radius: 50px;
	font-size: 16px;
	padding: 15px 30px;
	height: 55px;
	width: 100%;
}

input:focus {
	border-width: 2px;
	box-shadow: 0px 0px 10px hsla(0, 36%, 70%, 0.5);
	outline: none;
}

input::placeholder {
	color: hsl(0, 36%, 70%);
}

form.error input {
	border: 2px solid hsl(0, 93%, 68%);
}

button {
	background-image: linear-gradient(135deg, hsl(0, 80%, 86%), hsl(0, 74%, 74%));
	box-shadow: 2px 5px 10px hsla(0, 36%, 70%, 0.5);
	border: none;
	border-radius: 50px;
	cursor: pointer;
	padding: 15px;
	position: absolute;
	top: 0;
	right: 0;
	transition: opacity 0.2s ease;
	height: 55px;
	width: 100px;
}

button:hover {
	opacity: 0.6;
}

.error-icon {
	display: none;
	position: absolute;
	top: 15px;
	right: 110px;
}

form.error .error-icon {
	display: block;
}

small {
	color: hsl(0, 93%, 68%);
	display: none;
	margin-top: 15px;
	margin-left: 30px;
}

form.error small {
	display: block;
}

/* Animations */
@keyframes comeinleft {
	to {
		transform: translateX(0);
	}
}

@keyframes comeinright {
	to {
		opacity: 1;
		transform: translateX(0);
	}
}

@media screen and (max-width: 600px) {
	.logo {
		margin: 30px 0;
		width: 100px;
	}

	.bg-mobile {
		display: block;
		margin-left: -40px;
		margin-right: -40px;
		width: calc(100% + 80px);
	}

	h1 {
		font-size: 40px;
	}

	.left {
		width: 100%;
	}

	.right {
		display: none;
	}
}

Javascript

const form = document.getElementById('form');
const email = document.getElementById('email');

form.addEventListener('submit', e => {
	e.preventDefault();
	const emailVal = email.value;

	// check if it is a valid email
	if (!validateEmail(emailVal)) {
		form.classList.add('error');
	} else {
		form.classList.remove('error');
		document.body.innerHTML = `<div style="display:flex; align-items: center; justify-content: center;"><h1>Thank you!</h1></div>`;
	}
});

function validateEmail(email) {
	var re = /^(([^<>()\[\]\\.,;:\[email protected]"]+(\.[^<>()\[\]\\.,;:\[email protected]"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
	return re.test(String(email).toLowerCase());
}

Thanks for reading this article. Also check out other articles: website design using css grid and 10+ uses of javascript: You haven’t heard before

Default image
JatinRaj
Hello, My name is Jatin Raj and I am a web developer from India. I love to code every single day and share my thoughts with you people. Hobbies include reading books, football, and sketching/Painting.

2 Comments

  1. […] Thanks for reading my article on 3D Tilt-Shift Effect. If you liked it share with others and also check out other articles on: Single Price Card Design: Using Flexbox or 4 Best Ways to Host website for Free or Modern coming soon page. […]

  2. […] If you liked this article on parallax on hover effect, do share with others and also check out posts on 3D Tilt-Shift Effect(Awesome): Using Tilt.js(Vanilla js) or Modern coming soon page […]

Comments are closed.