Bootstrap version 5 Text On Image When Hover or Static Text

I couldn’t find an easy tutorial how to do text on image for Bootstrap version 5 when you mouse hover an image or a static text on the image.
So I have to try few solutions before get it right.

The solution is using purely CSS without any Javascript

The CSS

How To Use It

  1. Wrap the image in a div with class=”text-on-image”
  2. Under the div wrapper,include a text div with class=”text”
  3. You can add link or button

Demo on JSFiddle