setting up css variables in your stylesheet

Using css variables at the start of your stylesheet can make things down the road much easier to change.

You can also use it for more complex variables like drop shadow settings as shown below. 


<div class='demo-box main-pink'></div>


:root {
	/* Main Colours */
	--main-pink: pink; /* e.g: color: var(--main-pink); */
	--main-red: red; /* e.g: color: var(--main-red);  */

	/* Shadows */
	--main-drop-shadow: 0px 10px 20px rgba(0,0,0,0.5); /* box-shadow: var(--main-drop-shadow); */
.demo-box {
.main-pink {
  background: var(--main-pink);
  box-shadow: var(--main-drop-shadow);

Other Items in css

No Items Found.

Add Comment
Type in a Nick Name here
Page Views

This page has been viewed 550 times.

Search Code
Search Code by entering your search text above.

This is my test area for webdev. I keep a collection of code snippits here, mostly for my reference. Also if i find a good site, i usually add it here.


Random Quote
The mind must be given relaxation; it will arise better and keener after resting. As rich fields must not be forced-for their productiveness, the have no rest, will quickly exhaust them constantlabor will break the vigor of the mind, but if it is released and relaxed a little while, it will recover its powers