Create Magnifier Icon – Stunning CSS

thumbnail

In this tutorial, you will learn how to create magnifier icon using CSS. We will create container with background color #447D9B and border-radius 30%. The container size is 150x150px. Then, to create magnifier icon we need to the Glass and the Glass handler. The CSS to create magnifier icon is shown in below:

.container{
	display: flex;
	width: 150px;
	height: 150px;
	background: #447D9B;
	border-radius: 30%;
	overflow: hidden;
}
.magnifier{
	display: relative;
	background: transparent;
	width: 110px;
	height: 10px;
	position: relative;
	border-radius: 20px 20px 20px 20px;
	transform: rotateZ(45deg) scale(1.2);
	transform-origin: 40px 80px;
	position: relative;
	top: 0;
	left: 0;
}
.magnifier::before{
	content: '';
	display: block;
	background: #275878;
	width: 50px;
	height: 50px;
	position: absolute;
	border: 8px solid #FFF;
	border-radius: 50%;
	box-sizing: border-box;
	top: 30px;
	left: 30px;
}
.magnifier::after{
	content: '';
	display: block;
	background: #FFF;
	width: 40px;
	height: 10px;
	position: absolute;
	top: 50px;
	left: 80px;
	border-radius: 5px;
}

The full code is like below:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container{
	display: flex;
	width: 150px;
	height: 150px;
	background: #447D9B;
	border-radius: 30%;
	overflow: hidden;
}
.magnifier{
	display: relative;
	background: transparent;
	width: 110px;
	height: 10px;
	position: relative;
	border-radius: 20px 20px 20px 20px;
	transform: rotateZ(45deg) scale(1.2);
	transform-origin: 40px 80px;
	position: relative;
	top: 0;
	left: 0;
}
.magnifier::before{
	content: '';
	display: block;
	background: #275878;
	width: 50px;
	height: 50px;
	position: absolute;
	border: 8px solid #FFF;
	border-radius: 50%;
	box-sizing: border-box;
	top: 30px;
	left: 30px;
}
.magnifier::after{
	content: '';
	display: block;
	background: #FFF;
	width: 40px;
	height: 10px;
	position: absolute;
	top: 50px;
	left: 80px;
	border-radius: 5px;
}
</style>
</head>
<body>
 
<h2>Magnifier Icon - Stunning CSS </h2>
<div class="container">
  <div class="magnifier"></div>
</div>
 
</body>
</html>

When you open the file at browser, the result will be:

Back To Top