When I retrieve a product image URL from my database, I apply CSS styling to it on the front-end page. However, I need to dynamically pass the product image URL into the CSS that specifies the background image...
Here is my current CSS:
.product-image .bg{
background-image: url('https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?ixid=MXwxMjA3fDB8MHxzZWFyY2h8Mnx8dHNoaXJ0fGVufDB8fDB8&ixlib=rb-1.2.1&auto=format&fit=crop&w=900&q=60');
background-size: cover;
background-position: center top;
width: 100%;
min-height: 450px;
}
This is how the product page displays the background image:
<div class="product group">
<div class="col-1-2 product-image">
By placing "product-image" in the div, the product image is rendered. How can I dynamically insert this URL <%= data[I].IMAGE_URL %>
into the CSS? So instead of having ->
background-image: url('https://images.unsplash.com/photo-1521572163474-6864f9cf17ab?ixid=MXwxMjA3fDB8MHxzZWFyY2h8Mnx8dHNoaXJ0fGVufDB8fDB8&ixlib=rb-1.2.1&auto=format&fit=crop&w=900&q=60');
->
I want to have
background-image: url('<%= data[I].IMAGE_URL');
Is achieving this possible?