declare var in css code example
Example 1: css variable
:root {
--main-bg-color: pink;
}
body {
background-color: var(--main-bg-color);
}
Example 2: create variable in css
:root {
--tab-count: 5;
}
#div1 {
width: calc(100% - var(--tab-count));
}
Example 3: how to use variables in css
:root {
--clr-primary-1: hsl(205, 86%, 17%);
}
.container{
background-color: var(--clr-primary-3);
}