Hover on image to clear.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>RaHul GuPta</title>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
*
{
margin: 0;
padding: 0;
box-sizing: border-box;
}
body
{
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.container
{
position: relative;
width: 900px;
display: flex;
justify-content: space-between;
align-items: center;
}
.container .pixel
{
position: relative;
width: 400px;
height: 400px;
background: #000;
}
.container .pixel img
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
image-rendering: pixelated;
}
.container .pixel img:last-child
{
transition: 2s;
}
.container .pixel:hover img:last-child
{
opacity: 0;
}
</style>
</head>
<body>
<div class="container">
<div class="pixel">
<!-- image # should be in 400*400 -->
<!-- image * should be in 20*20 -->
<img src="1.jpg">
<img src="4.jpg">
</div>
<div class="pixel">
<!-- image # should be in 400*400 -->
<!-- image * should be in 20*20 -->
<img src="2.jpg">
<img src="3.jpg">
</div>
</div>
</body>
</html>