At the moment i have styles defined as:
.style1 { background-image: url("../images/kitten1.jpg"); }
.style2 { background-image: url("../images/kitten2.jpg"); }
.style3 { background-image: url("../images/kitten3.jpg"); }
and use it in HTML as:
<div class="style1"></div>
<div class="style2"></div>
<div class="style3"></div>
I have removed the crud but in essence the styles are all the same except for the url string of the background-image. If i require many of such styles it becomes annoying if i want to make a small change to all of them.
A quick search on SO shows it is not possible to pass arguments to CSS because it doesn't interact with HTML. However, i wonder if there is any way in which i could pass the url to only a single style, i.e.:
.style { background-image: url(url_string); }
and apply it in HTML with something like:
<div class="style" url_string="../images/kitten1.jpg"></div>
<div class="style" url_string="../images/kitten2.jpg"></div>
<div class="style" url_string="../images/kitten3.jpg"></div>
using HTML, CSS, JQuery, LESS, SASS, etc?