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 :: Align vertically and horizontally 
Css :: how to make text transparent with stroke in css 
Css :: linear-gradient 
Css :: css focus border radius 
Css :: transition timing function css 
Css :: css center table on page 
Css :: warning: LF will be replaced by CRLF in Design/css/bootstrap.min.css. 
Css :: css gradient bottom page 
Css :: css prevent margin collapsing 
Css :: put gradient color over background image 
Css :: difference between private key and private key ssh 
Css :: uninstall tinyproxy ubuntu 
Css :: line-weight css 
Css :: what are the types of positioning in css 
Css :: last child after css 
Css :: background pulled to corner on small screens 
Css :: collapse border css 
Css :: what does align items center do 
Css :: jquery replace css class 
Css :: text stroke css 
Css :: z index 
Css :: how to select child when hover on parent element css 
Css :: css flex bottom 
Css :: alternate css animation 
Css :: make previous commit master 
Css :: bootstrap put button on one line 
Css :: changer angle div 
Css :: css fade change coloir 
Css :: how to make two different animations to one element css 
Css :: nesting in sass 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =