Can I Use 'Variables' in CSS ? Yes !! Let's see how
Anuj Singh
Posted on July 3, 2020
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
💖 💪 🙅 🚩
Anuj Singh
Posted on July 3, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.