A var() function is used to declare CSS variables. Variables are helpful in designing web pages. If we use a similar value on multiple places then it is good to declare a CSS variable.
It's very easy to declare a CSS3 variable. A var() function is used to declare a CSS variable. Here we will learn to declare variables.
<style>
	/*declare a css variable*/
:root{
	--main-color-value:green;
}
div{
	background-color:var(--main-color-value);
}
</style><head>
	<style>
	/*declare a css variable*/
		:root{
			--main-color-value:green;
		}
		div{
			width:100px;
			height:100px;
			background-color:var(--main-color-value);
		}
	</style>
</head>
<body>
	<div></div>
</body>
some other examples of CSS3 variable declaration.
 
<style>
/*padding*/
		:root{
			--tdb-padding:10px;
			--tab-width:100px;
		}
		div{
			width:var(--tab-width);
			height:100px;
			padding:(--tab-padding)
		}
</style>