HTML CSS examples for CSS Widget:Image Text Position
Positioning text relative to an image when the image size changes
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> .imageholder {<!--from w ww. j av a 2s . c om--> position:relative; float:left; } .caption { position:absolute; top:0; left:0; right:0; font-family:Helvetica,sans-serif; font-size:2em; background:Chartreuse; color:yellow; padding:2em 3em; } </style> </head> <body> <div class="imageholder"> <div class="caption"> Lorem ipsum dolor s </div> <img src="https://www.java2s.com/style/demo/Safari.png"> </div> </body> </html>