Home
CSS
CSS @property
Tryit: Animation of gradient with @property
Run ❯
Get your
own
website
Result Size:
625 x 534
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <head> <style> @property --startColor { syntax: "<color>"; initial-value: #EADEDB; inherits: false; } @property --endColor { syntax: "<color>"; initial-value: #BC70A4; inherits: false; } .ex1 { background: linear-gradient(var(--startColor), var(--endColor)); animation: gradient 3s linear infinite; } @keyframes gradient { 0%, 100% { --startColor: #EADEDB; --endColor: #BC70A4; } 50% { --startColor: #BC70A4; --endColor: #BFD641; } } #grad1 { height: 200px; } </style> </head> <body> <h1>The @property Rule</h1> <p>The @property rule is here used to animate a gradient:</p> <div id="grad1" class="ex1"></div> </body> </html>