<form class="container">
		<label class="switch">
			<input type="checkbox">
		</label>
</form>
* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

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

.container {
	background: #212221;
	background: linear-gradient(to right, #1560bd, #e90);
	border-radius: 50px;
	height: 40px;
	position: relative;
	width: 75px;	
}

input {
	-webkit-appearance: none;
	cursor: pointer;
	height: 100%;
	position: absolute;
	width: 100%;
}

input::before {
	background: #ffffff;
	border-radius: 50px;
	content: "";
	height: 70%;
	position: absolute;
	top: 50%;
	transform: translate(7px, -50%);
	width: 85%;
}

input::after {
	background: linear-gradient(to right, orange, #8e2de2);
	border-radius: 50px;
	content: "";
	height: 25px;
	opacity: 0.6;
	position: absolute;
	top: 50%;
	transform: translate(7px, -50%);
	transition: all .4s;
	width: 25px;
}

input:checked::after {
	opacity: 1;
	transform: translate(170%, -50%);
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.