Position responsive image caption - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Caption

Description

Position responsive image caption

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
.img-wrap {<!-- w  w w.  j  a  v a  2  s .  com-->
   position:relative;
}

img {
   width:100%;
}

.caption {
   position:absolute;
   bottom:16%;
   right:0;
   background:Chartreuse;
   color:yellow;
   padding:0.6em;
}
</style> 
 </head> 
 <body> 
  <div class="img-wrap"> 
   <img src="https://www.java2s.com/style/demo/InternetExplorer.png" alt="test image"> 
   <div class="caption"> 
    <p>Lorem ipsum dolor sit amet, consectet</p> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials