I am trying to set color of a div dynamically.
To give an overview of issue, let's check below things:
<!doctype html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="shape" id="shape1"></div>
<div class="shape" id="shape2"></div>
<div class="shape" id="shape3"></div>
</body>
</html>
Below is the CSS I am using:
.shape {
display: inline-block;
width: 200px;
height: 200px;
background: #dfd;
margin: 20px;
}
Is it possible that I can give class="shape-fdd"
in html then it show light red color, if I give class="shape-dfd"
then it show light green color?
I have just looked into LESS for the same but I don't know if it can provide this feature.
I don't look for jQuery solutions for this. Only CSS or with LESS or SASS if possible.
Any help is appreciated.