My webpage features a bootstrap 4 container
with three columns that adjust on screen sizes above the md breakpoint (col-md-4
).
Each column contains an img
with the class img-fluid
, and when hovered over, text description appears. I want this hover text to scale appropriately with the resizing of each image so it always fits perfectly on top of the image.
In my current attempt, as the images resize, the text overflows its container – I aim to prevent this by responsively resizing the text to fit the container.
I've experimented with fitty, which works well for normal text but doesn't quite achieve what I had hoped for with my hover text.
Could there be something incorrect in my approach, or is there a better way (preferably using existing Bootstrap 4 classes) to accomplish this?
// fitty('.fit');
fitty('#my_fit');
fitty('#fit1');
fitty('#fit2');
fitty('#fit3');
.hvrbox {
position: relative;
display: inline-block;
overflow: hidden;
max-width: 100%;
height: auto;
}