CSS Fire Animation
Realistic fire animation effect using gradient and keyframes
Code
.fire-container {
width: 100px;
height: 200px;
position: relative;
margin: 0 auto;
}
.fire {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 80px;
height: 150px;
background: linear-gradient(to top, #ff4500 0%, #ff8c00 30%, #ffd700 60%, #ffffff 100%);
border-radius: 50% 50% 20% 20%;
animation: fire-flame 0.8s infinite alternate;
opacity: 0.9;
}
.fire::before {
content: '';
position: absolute;
width: 100px;
height: 120px;
background: linear-gradient(to top, #ff8c00 0%, #ffd700 50%, #ffffff 100%);
border-radius: 50%;
bottom: 10px;
left: -10px;
animation: fire-glow 1s infinite alternate;
opacity: 0.6;
}
@keyframes fire-flame {
0% { transform: translateX(-50%) scale(1); }
100% { transform: translateX(-50%) scale(1.1); }
}
@keyframes fire-glow {
0% { opacity: 0.5; }
100% { opacity: 0.8; }
}HTML
<"attr-name"</span>>class</span>="tag"</span>>div</span> "attr-name"</span>>class</span>="fire-container"</span>>
<"attr-name"</span>>class</span>="tag"</span>>div</span> "attr-name"</span>>class</span>="fire"</span>></"attr-name"</span>>class</span>="tag"</span>>div</span>>
</"attr-name"</span>>class</span>="tag"</span>>div</span>>