Home
CSS
CSS @property
Tryit: Another simple use of @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 --my-bg-color { syntax: "<color>"; inherits: true; initial-value: lightgray; } div { width: 300px; height: 150px; padding: 15px; background-color: var(--my-bg-color); } .fresh { --my-bg-color: #ff6347; } .nature { --my-bg-color: rgb(120, 180, 30); } </style> </head> <body> <h1>The @property Rule</h1> <div>DIV1</div> <div class="fresh">DIV2</div> <div class="nature">DIV3</div> </body> </html>