Display text and images in the center of div - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Image Text

Description

Display text and images in the center of 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">
#kolom5Nav {<!--   w w  w .  j  av a2s . c o m-->
   display:block;
   position:relative;
   height:142px;
   width:100%;
   background:Chartreuse;
   color:yellow;
   text-align:center;
}

#kolom5Nav .container {
   position:absolute;
   top:51%;
   transform:translate(0%, -51%);
   width:100%;
}

#kolom4Back, #kolom4Forward, h2 {
   display:inline;
}
</style> 
 </head> 
 <body> 
  <div id="kolom5Nav"> 
   <div class="container"> 
    <a href="#"> <img id="kolom4Back" src="https://www.java2s.com/style/demo/Opera.png"> </a> 
    <h2>Lorem ipsum</h2> 
    <a href="#"> <img id="kolom4Forward" src="https://www.java2s.com/style/demo/Opera.png"> </a> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials