Make text appear below the center image - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Make text appear below the center image

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">
html, body
 {
   height:100%;
   margin:0;
   padding:0;
   background-color:Chartreuse;
}

div {<!-- w w w.  j  av  a  2s  . c o  m-->
   position:relative;
   height:100%;
   width:100%;
}

div img {
   position:absolute;
   top:0;
   left:0;
   right:0;
   bottom:0;
   margin:auto;
}

p {
   text-align:center;
   margin-top:-51px;
}
</style> 
 </head> 
 <body> 
  <div> 
   <img src="https://www.java2s.com/style/demo/Opera.png"> 
   <p>Lorem ipsum</p> 
  </div>  
 </body>
</html>

Related Tutorials