Created
June 23, 2024 12:55
-
-
Save geekboots-team/8b02604eca95cc7afc4ea520424f331e to your computer and use it in GitHub Desktop.
How to create animated bell notification using HTML CSS and SVG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Animated Bell Icon</title> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| } | |
| section { | |
| width: 100%; | |
| height: 100vh; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| } | |
| section a { | |
| width: 50px; | |
| height: 50px; | |
| } | |
| section a svg { | |
| fill: #f54768; | |
| width: 50px; | |
| height: 50px; | |
| animation: shake 1s forwards infinite; | |
| } | |
| @keyframes shake { | |
| 10% { | |
| transform: rotate(15deg); | |
| } | |
| 20% { | |
| transform: rotate(-15deg); | |
| } | |
| 30% { | |
| transform: rotate(15deg); | |
| } | |
| 35% { | |
| transform: rotate(-15deg); | |
| } | |
| 40% { | |
| transform: rotate(15deg); | |
| } | |
| 45% { | |
| transform: rotate(-15deg); | |
| } | |
| 50% { | |
| transform: rotate(0deg); | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <section> | |
| <a href=""> | |
| <svg | |
| id="Layer_1" | |
| data-name="Layer 1" | |
| xmlns="http://www.w3.org/2000/svg" | |
| viewBox="0 0 546.23 546.32" | |
| > | |
| <path | |
| d="M272.18,546.24a54.9,54.9,0,0,1-54.89-54.89H327.06A54.89,54.89,0,0,1,272.18,546.24Z" | |
| /> | |
| <path | |
| d="M504.36,435.94v28.25H40.27V435.13l54.07-53.27L96,218C108.06,86.45,228.33,57.4,228.33,57.4h2.82V38.59A37.79,37.79,0,0,1,246.32,8c.42-.3.86-.61,1.31-.91C268.25-6.77,296.74.7,308.2,22.77c.29.56.58,1.15.87,1.75a50.58,50.58,0,0,1,4.81,21.86V57.93c137.2,45.57,135.2,160.89,135.2,160.89V380.65Z" | |
| /> | |
| <path | |
| d="M149.51,71S85.18,106.57,74.77,204.59H31.88s2.45-102.92,89.45-163Z" | |
| /> | |
| <path | |
| d="M390.38,74s66,32.37,81.14,129.77l42.83-2.08S506.91,99,417.1,43.21Z" | |
| /> | |
| </svg> | |
| </a> | |
| </section> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment