Search
 
SCRIPT & CODE EXAMPLE
 

CSS

css set variable

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

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

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

css variable

:root {
  --main-bg-color: pink;
}
body {
  background-color: var(--main-bg-color);
}
Comment

css variables

:root {
  --background-color: #333;
  --text-color: #fff;
}
body {
  background-color: var(--background-color);
  color: var(--text-color);
}
Comment

variables css

:root {
    --main-bg-color: brown;
  }
  
.uno {
    color: white;
    background-color: var(--main-bg-color);
    margin: 10px;
    width: 50px;
    height: 50px;
    display: inline-block;
}
Comment

css variables

:root {
  --first-color: #16f;
  --second-color: #ff7;
}

#firstParagraph {
  background-color: var(--first-color);
  color: var(--second-color);
}

#secondParagraph {
  background-color: var(--second-color);
  color: var(--first-color);
}

#container {
  --first-color: #290;
}

#thirdParagraph {
  background-color: var(--first-color);
  color: var(--second-color);
}
Comment

create variable in css

:root {
  --tab-count: 5;
}

#div1 {
  width: calc(100% - var(--tab-count));
}
Comment

VAR IN CSS

/* var */
:root{
    --blue--:#2874f0;
}
/* Css reset */
* {
    margin: 0;
    padding: 0;
}

/* header styles */
header {
    background-color: var(--blue--);
    position: sticky;
    top: 0;
    height: 5vw;
    display: flex;
    justify-content: center;
    align-items: center;
}
Comment

how to use variables in css

:root {
  --clr-primary-1: hsl(205, 86%, 17%);
}

.container{
  background-color: var(--clr-primary-3);
}
Comment

css variable

...
<style>
	:root{
  		--couleur-principale: brown;
	}
	#test1{
		color:var(--couleur-principale);
	}
</style>
...
Comment

CSS Variables

body { background-color: #1e90ff; }

h2 { border-bottom: 2px solid #1e90ff; }

.container {
  color: #1e90ff;
  background-color: #ffffff;
  padding: 15px;
}

button {
  background-color: #ffffff;
  color: #1e90ff;
  border: 1px solid #1e90ff;
  padding: 5px;
}
Comment

PREVIOUS NEXT
Code Example
Css :: add black layer on image css 
Css :: install cors 
Css :: make mat card scrollable 
Css :: add glow to image css 
Css :: css content image 
Css :: aligning form elements to center in css 
Css :: center div absolute 
Css :: remove border css 
Css :: css text bottom to top 
Css :: How to prevent anchor links from scrolling behind a sticky header with one line of CSS 
Css :: how to make background more darker with css 
Css :: css animation animated element goes back to previous state 
Css :: scss watch command 
Css :: css detect mobile 
Css :: css on hover do something to children 
Css :: flex max slang meaning 
Css :: background-image linear gradient and border radius 
Css :: css 2 <p next to each other 
Css :: ionchips scroll x 
Css :: anchor tag taking up all the width of the page 
Css :: css grid reverse column order 
Css :: check if audio element is playing css 
Css :: ul li dot seprator 
Css :: how to set background image for button in css 
Css :: coustomize srollbar 
Css :: css parallelogram 
Css :: reduire espace entre ligne css 
Css :: text in circle css 
Css :: circular div css 
Css :: css button disabled hover 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =