We often declare variables using the :root
selector that targets the html
element. We can then access these variables using the var()
function.
:root {
--color-primary: #ffdd36;
--border-size: 2px;
--border-radius: 10px;
}
.one {
background: var(--color-primary);
}
.two {
background: var(--color-primary);
}