I am currently working on dynamically setting the color of a div.
To provide some context, let's examine the following:
<!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>
Here is the CSS code I have implemented:
.shape {
display: inline-block;
width: 200px;
height: 200px;
background: #dfd;
margin: 20px;
}
I am exploring if it's feasible to use class="shape-fdd"
in the HTML to display a light red color, and using class="shape-dfd"
for a light green color.
I have briefly researched LESS, but I'm uncertain if it supports this functionality.
I prefer not to rely on jQuery for a solution. Instead, I am looking for options within CSS or utilizing LESS or SASS if applicable.
Any assistance or guidance would be greatly appreciated.