Answers for "CSS Global variables"

CSS
52

css set variable

:root {
  --main-bg-color: coral;
}

#div1 {
  background-color: var(--main-bg-color);
}

#div2 {
  background-color: var(--main-bg-color);
}
Posted by: Guest on December-27-2019
0

CSS Global variables

:root {
	--global--color-primary: #28303d;
}

a {
	color: var(--global--color-primary);
}

.social-icons a {
	background: var(--global--color-primary);
}
Posted by: Guest on June-25-2021
10

css variables

/* "css variables" */
/* not for ie but good for Edge and other browser :D */

/*
 By declaring a custom property on the :root pseudo-class
 and using it where needed throughout the document
*/
:root {
  --primary-bg: #8a2be2;
  --btn-font-size: 18px;
  --btn-padding: 10px 15px;
}

.btn-primary {
  background-color: var(--primary);
  font-size: var(--btn-font-size);
  padding: var(--btn-padding);
  color: #E2E2E2;
}
Posted by: Guest on May-02-2020

Code answers related to "CSS Global variables"

Browse Popular Code Answers by Language