I have a div class with an image src and within that I currently have a div for the dynamic text inside this although am open to suggestions.
<div class=“image-container”>
<img src=“/assets/product.jpg”)>
<div class="preview-container">
<img src="/assets/images/Product_1.jpg" class="prv-img">
<div class="preview-text">
<div class="text-outputs">
<p data-name=“line_1”>SAMPLE TEXT !</p>
<p data-name=“line_2”>SAMPLE TEXT 2</p>
<p data-name=“line_3”>SAMPLE TEXT3</p>
</div>
</div>
</div>
</div>
This image remains the same aspect ratio but the image size changes responsively either by jumping to breakpoint sizes, or for smaller screens sizing continuously dependent on screen width.
As hinted at in the code above, on top of this image I want to superimpose 3 lines of text that give the impression that this text is written on the image of the product itself. For some context, it is a photo of a bottle with a blank white label on it and I want to superimpose some words like, Drink XYX, crafted since 1923, Drink Responsibly
I want the text size, spacing, line height and relative positioning of the text on the image to scale continuously as the image changes size.
Any ideas on how to do this. Is it possible with just css or will I need some javascript too?
Any suggestions would be truly welcome.
Jason