Did you know that CSS Custom Properties can handle images too?

added by JavaScript Kicks
2/28/2019 8:13:16 AM

444 Views

So you might be aware of CSS Custom Properties that let you set a variable, such as a theme color, and then apply it to multiple classes like this: :root { --theme: #777; } .alert { background: var(--theme); } .button { background: var(--theme); } Well, I had seen this pattern so often that I thought Custom Properties could only be used for color values like rgba or hex - although that's certainly not the case!


0 comments