I am into the web development field for a quite long time now, but I am today year old when discovered that we can use variables in our CSS3.
So let's get started.
Assume that you are applying font-family property to 4 or 5 elements and that's where variable comes into action.
The variable with its property is defined and declared in :root with -- prefixed with the variable name.
:root {
--varfont: 'Roboto', sans-serif;
}
And use it like this :
h1
{
font-family: var(--varfont);
}
Hope it helped you !!!
Follow me for more such content :
Instagram : https://instagram.com/anujcodeop
Portfolio : https://anujportfolio.herokuapp.com
Top comments (0)