Make paragraph on top of image inside a div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image

Description

Make paragraph on top of image inside a div

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-cont {<!--from   w  w  w . j  a  v  a  2s . c o  m-->
   width:351px;
   height:151px;
}

.img-cont p {
   margin:0px;
   padding:6px;
   position:relative;
   top:-151px;
   left:0px;
}
</style> 
 </head> 
 <body> 
  <div class="img-cont"> 
   <img src="https://www.java2s.com/style/demo/Safari.png"> 
   <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </p> 
  </div>  
 </body>
</html>

Related Tutorials