I want to add a transparent black overlay over an img tag
with some text in it, like in the example screenshot below. Ideally only with HTML
and CSS
.
I have been searching for hours and can’t find anything.
I know this could be easily done if the image is used as a background, but this isn’t an option for us (SEO reasons).
2
Answers
That shouldn’t be so bad. Would something like this work? First some HTML:
Mic.com used the following code:
I changed it slightly. You could also use their code with on a sibling div element of the image & the parent having
position: relative;
or use one like mine.