How do you use CSS variables?
Define a variable with --name and access it with var().
Example:
:root {
- -main-color: #007bff;
- -padding: 10px;
button {
background: var(--main-color);
padding: var(--padding);
Follow me on LinkedIn:
Key Takeaway:
CSS variables make styles dynamic and reusable.