Problem statement is, I have 2-3 web pages; and I want to have different body colors on this pages but keeping the class name unique to "myBody".
I looked for many blogs and authors but did not find any suitable answer to achieve this from a traditional CSS approaches.
Please suggest if it is possible to have a single CSS class accepting a parameter from a web page which will decide what body color should be applied using the same CSS with different parameters"
.myBody(@color)
{
background-color: @color;
font-size: 11px;
color: Black;
border: 1px solid;
}
The answer may be tricky for some folks but I really want to see if I can achieve this using CSS only.
.myBody.red { background-color: red; }<body>tag and then access that in the CSS rule via theattr()operator, but that's not supported widely (if at all) today.attr()can only be used incontentso far, and was wondering if/when there are plans to extend it to the rest of propertiesattr()on thecontentproperty.