<div id="modal" class="modalContainer">
	<div class="modal">
		<button class='closeModal'>x</button>
		<h3 class='caption'>Sign up</h3>
		<form>
			<input type="text" placeholder='Name...'>
			<input type="text" placeholder='E-mail...'>
			<input type="text" placeholder='Password...'>
			<input type="submit" value='Enter' >
		</form>
	</div>
</div>

<button class="viewModal" onClick='showModal("modal")'>View</button>
* {
	border: 0;
	padding: 0;
	margin: 0;
	outline: 0;
	box-sizing: border-box;
}

body {
	width: 100vw;
	height: 100vh;
	display: flex;
	justify-content: center;
	align-items: center;
}

.modalContainer {
	width: 100vw;
	height: 100vh;
	display: none;
	justify-content: center;
	align-items: center;
	position: fixed;
	top: 0;
	left: 0;
	background: rgba(0, 0, 0, .5);
	z-index: 100;
	animation: back 300ms linear both;
}

@keyframes back {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

.showModal {
	display: flex;
}

.modal {
	background: #c7c7c7;
	width: 450px;
	height: 300px;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
	border: 2px solid #343434;
	border-radius: 10px;
	position: relative;
	animation: modal 300ms both;
}

@keyframes modal {
	from {
		opacity: 0;
		transform: translateY(-10%);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.closeModal {
	width: 40px;
	height: 40px;
	display: flex;
	justify-content: center;
	align-items: center;
	background: #343434;
	border-radius: 50%;
	font-family: 'Ubuntu', sans-serif;
	font-size: 20px;
	font-weight: bold;
	color: white;
	position: absolute;
	top: -20px;
	right: -20px;
	cursor: pointer;
}

.caption {
	margin-bottom: 5%;
	font-family: 'Ubuntu', sans-serif;
	font-weight: bold;
	font-size: 25px;
}

form {
	width: 100%;
	height: auto;
	display: flex;
	justify-content: center;
	align-items: center;
	flex-direction: column;
}

input[type='text'] {
	width: 80%;
	height: 2rem;
	margin-bottom: 2%;
	background: none;
	border-bottom: 2px solid #343434;
}

input[type='text']::placeholder {
	font-family: 'Ubuntu', sans-serif;
	color: #343434;
}

input[type='submit'] {
	width: 50%;
	height: 2.5rem;
	margin-top: 2%;
	border-radius: 100px;
	background: #343434;
	font-family: 'Ubuntu', sans-serif;
	font-size: 18px;
	font-weight: bold;
	color: white;
	cursor: pointer;
}

.viewModal {
	width: 100px;
	height: 30px;
	background-color: blue;
	border-radius: 5px;
	font-family: 'Ubuntu', sans-serif;
	font-size: 16px;
	font-weight: bold;
	color: white;
	cursor: pointer;
}
const showModal = (modalId) => {
	const modal = document.getElementById(modalId);
	if(modal) {
		modal.classList.add('showModal');
		modal.addEventListener('click', (event) => {
			if(event.target.id === modalId || event.target.className === 'closeModal') {
				modal.classList.remove('showModal');
			}
		});
	}
};

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.