Variables in css
custome properties in css
local and global variables in css
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Css and custom varaible in css</title>
</head>
<style>
/* global variable in css */
:root{
--primary-color:blue;
--background-color: green;
--background-color1: yellow;
}
.container {
/* local variable in css */
--primary-color:blue;
--background-color: green;
--background-color1: yellow;
margin: 2px;
display: flex;
border: 2px solid var(--primary-color);
background-color: var(--background-color1);
}
.card{
background-color: var(--background-color);
padding: 50px 50px;
margin: 2px auto;
border: 1px solid --primary-color;
justify-content: center;
align-items: center;
width: 100px;
}
</style>
<body>
<div class="container">
<div class="card" id="card1">card1</div>
<div class="card" id="card2">card2</div>
<div class="card" id="card3">card3</div>
</div>
</body>
</html>
Thanks you for commenting your questions. I will see question and respond you.