Recently, I came across a unique challenge involving a div with an image background:
<div class="image-cover" style={{ backgroundImage: 'url(' + item.image + ')' }}>
<div className="name">{item.name}</div>
</div>
(this code is written in React and the above div has the image set as a background.)
I was looking to add a dark gradient overlay on the image, starting from the bottom and fading up. Most online resources suggest adding the image directly to the CSS for such effects. However, my case involves dynamic assignment of the image URL during runtime through HTML.
Do you have any suggestions on how I can achieve this desired effect of darkening the image within this setup?