Creative CSS Animation Building a Party Emoji with HTML and CSS By Engineer Robin
CSS is not just for styling layouts — it can be used to craft beautiful animated illustrations, icons, and visual effects. In this guide, we’ll explore a SCSS-powered party emoji animation built entirely with HTML and SCSS. This minimal yet dynamic animation simulates a party popper emoji 🎉, complete with facial features and animated flair.
✅ HTML Structure Breakdown
<div class="party" title=":party:">
<a title=":party:">
<ul>
<li></li> <!-- Left Eye -->
<li></li> <!-- Right Eye -->
<li></li> <!-- Mouth -->
<li></li> <!-- Plume (Confetti) -->
</ul>
</a>
</div>
Explanation:
<div class="party">
: This is the main container for the animation. Positioned at the center of the screen.<a title=":party:">
: A wrapper, semantically representing a party icon (although it doesn’t link anywhere).<ul><li></li>...</ul>
: A group of<li>
elements used to design:- Eyes (2)
- Mouth (1)
- A decorative plume/confetti (1)
🎨 SCSS Styling and Animation Explained
We use SCSS variables for maintainability:
$unit: 8px; // Base size unit
$black-1: #222; // Eye color
🔧 Global Reset
* {
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
color: inherit;
outline: none;
font-weight: inherit;
font-size: 1em;
}
This ensures consistency across all browsers by resetting common default styles.
🟪 .party
Container
.party {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: $unit * 6;
height: $unit * 6;
}
- Centered using
position: absolute
andtransform
. - Defines a 48x48px box (
6 * 8px
) to build the party emoji.
Creative CSS Animation Building a Party Emoji with HTML and CSS
🧠 .party::before
— The Party Popper Cone
&:before {
content: "";
border-right: $unit * 3 solid transparent;
border-bottom: $unit * 3 solid #B4B4F3;
border-left: $unit * 3 solid transparent;
width: $unit * 6;
height: $unit * 6;
animation: party-body .5s linear infinite;
}
- Creates a triangle (party cone) using
border-trick
. - Colored bottom border gives the illusion of a party hat.
- Animated using
@keyframes party-body
.
🟣 Party Face – ul
ul {
width: $unit * 4;
height: $unit * 4;
border-radius: 50%;
background: #7272E9;
position: absolute;
left: $unit;
top: 0;
animation-name: party-head;
}
- Circular head on top of the cone.
- Positioned centrally.
- Animated to wiggle and change color.
👀 Eyes and Mouth (li
elements)
Each <li>
represents a part of the face:
li:nth-child(1), li:nth-child(2) {
background: $black-1;
border-radius: 50%;
width: $unit * .75;
height: $unit * .75;
position: absolute;
top: $unit;
}
li:nth-child(1) { right: $unit / 2; } // Right Eye
li:nth-child(2) { left: $unit; } // Left Eye
- Black circles for eyes.
li:nth-child(3) {
border-left: $unit * .5 solid transparent;
border-top: $unit * 2 solid #F5D875;
border-right: $unit * .5 solid transparent;
width: 0;
height: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translateY(-50%);
}
- Mouth in a triangular shape, facing downward.
Creative CSS Animation Building a Party Emoji with HTML and CSS
🎊 Plume (Confetti Animation)
li:nth-child(4) {
border-top: $unit * .75 solid transparent;
border-left: $unit * .75 solid #3DF2C2;
border-bottom: $unit * .75 solid transparent;
width: 0;
height: 0;
position: absolute;
top: 0;
left: 50%;
transform: translateY(-50%);
animation-name: party-plume;
}
- Decorative plume element simulating confetti or ribbon.
- Animated to cycle through multiple colors.
🔁 Keyframe Animations
🎩 @keyframes party-body
@keyframes party-body {
0%, 100% { border-bottom-color: #B4B4F3; }
25% { border-bottom-color: #70EEFA; }
50% { border-bottom-color: #A7F9E3; }
75% { border-bottom-color: #FF6270; }
}
- Changes color and shape of the cone to mimic flickering or pulsing.
😄 @keyframes party-head
@keyframes party-head {
0%, 100% {
transform: translate(0%, 0%) rotate(0deg);
background: #7272E9;
}
25% {
transform: translate(-37.5%, 12.5%) rotate(22.5deg);
background: #51CFDB;
}
...
}
- Simulates bouncing and rotating head movement.
- Changes background to give it a lively feel.
🎉 @keyframes party-plume
@keyframes party-plume {
0%, 100% { border-left-color: #3DF2C2; }
25% { border-left-color: #7272E9; }
...
}
- Plume flashes different colors for an added celebratory vibe.
Creative CSS Animation Building a Party Emoji with HTML and CSS
💡 Conclusion
This SCSS-powered animation is a fun, creative use of:
- SCSS variables for modularity
- Pure HTML/CSS (no JS!)
- Clever usage of
border
properties to draw shapes - Multiple keyframe animations to bring it alive
🧪 Demo Use Cases
- Loading screens 🎬
- Celebration messages 🎈
- Error or success animations 🚀
- Gamification effects 🌟
📦 Optimization Tips
- Use
will-change
to optimize performance. - Consider pausing animations when off-screen or using
prefers-reduced-motion
.
Creative CSS Animation Building a Party Emoji with HTML and CSS
🌐 Want the Code?
<div class="party" title=":party:">
<a title=":party:">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</a>
</div><div class="party" title=":party:">
<a title=":party:">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</a>
</div>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
color: inherit;
outline: none;
font-weight: inherit;
font-size: 1em;
}
body {
background-color: #3d3e6f;
}
.party {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 48px;
height: 48px;
}
.party * {
animation-duration: 0.5s;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.party:before {
content: "";
border-right: 24px solid transparent;
border-bottom: 24px solid #b4b4f3;
border-left: 24px solid transparent;
width: 48px;
height: 48px;
animation: party-body 0.5s linear infinite;
}
.party ul {
width: 32px;
height: 32px;
border-radius: 50%;
background: #7272e9;
position: absolute;
top: 0;
left: 8px;
animation-name: party-head;
}
.party ul li:nth-child(3) {
border-left: 4px solid transparent;
border-top: 16px solid #f5d875;
border-right: 4px solid transparent;
width: 0;
height: 0;
position: absolute;
left: 50%;
top: 50%;
transform: translateY(-50%);
}
.party ul li:nth-child(2) {
background: #222;
border-radius: 50%;
width: 6px;
height: 6px;
position: absolute;
top: 8px;
left: 8px;
}
.party ul li:nth-child(1) {
background: #222;
border-radius: 50%;
width: 6px;
height: 6px;
position: absolute;
top: 8px;
right: 4px;
}
.party ul li:nth-child(4) {
border-top: 6px solid transparent;
border-left: 6px solid #3df2c2;
border-bottom: 6px solid transparent;
width: 0;
height: 0;
position: absolute;
left: 50%;
top: 0;
transform: translateY(-50%);
animation-name: party-plume;
}
@keyframes party-body {
0%, 100% {
border-right-width: 24px;
border-left-width: 24px;
border-bottom-color: #b4b4f3;
}
25% {
border-right-width: 44px;
border-left-width: 4px;
border-bottom-color: #70eefa;
}
50% {
border-right-width: 24px;
border-left-width: 24px;
border-bottom-color: #a7f9e3;
}
75% {
border-right-width: 12px;
border-left-width: 36px;
border-bottom-color: #ff6270;
}
}
@keyframes party-head {
0%, 100% {
transform: translate(0%, 0%) rotate(0deg);
background: #7272e9;
}
25% {
transform: translate(-37.5%, 12.5%) rotate(22.5deg);
background: #51cfdb;
}
50% {
transform: translate(0%, 25%);
background: #3ad4ac;
}
75% {
transform: translate(25%, 12.5%) rotate(-11.25deg);
background: #e04351;
}
}
@keyframes party-plume {
0%, 100% {
border-left-color: #3df2c2;
}
25% {
border-left-color: #7272e9;
}
50% {
border-left-color: #ff479e;
}
75% {
border-left-color: #ff8c62;
}
}
Table of Contents
Creative CSS Animation Building a Party Emoji with HTML and CSS