ring illusion with html css

Ring illusion with html css

Source codes:

<!DOCTYPE html>
<html>
<head>
<style>

:root{
–c1:#78bcf1;
–c2:#0e8ef3;
}

body{
margin: 0;
padding: 0;
width: 100%;
height: 100vh;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(146deg, #04567b, #4A148C);
}

.content{
width: 50vmin;
height: 28vmin;
display: flex;
margin: 0 auto;
align-items: center;
justify-content: center;
transform: scale(1.5);
}

.ring{
–color:var(–c1);
–shadow:var(–c2);
position: absolute;
width: 42vmin;
height: 18vmin;
border-radius: 100% 100% 60% 100%;
box-sizing: border-box;
margin-top: -3.6vmin;
background: radial-gradient(ellipse at 20vmin 9vmin,#fff0 calc(10vmin + 0px), var(–color) calc(10vmin + 2px));
}

.ring:nth-child(2){
–color: var(–c2);
–shadow: var(–c1);
margin-top: 5.85vmin;
border-radius: 60% 100% 100% 100%;
}

.ring:nth-child(3){
clip-path: polygon(0 0, 50% 0, 50% 100%, 0% 100%);
}

</style>
</head>
<body>

<div class=”content”>
<div class=”ring”></div>
<div class=”ring”></div>
<div class=”ring”></div>
</div>

</body>
</html>

Scroll to Top