Centering an image over a CSS div table - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Table

Description

Centering an image over a CSS div table

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">
.container {<!--  w  ww  .j a v  a 2 s.  c  o m-->
   display:table-row;
   position:relative;
   width:100%;
}

.row {
   display:table-row;
   width:100%;
}

.cell {
   position:relative;
   display:table-cell;
   background-color:Chartreuse;
   width:701px;
   height:auto;
}

body {
   margin:0;
   padding:0;
}

#logo {
   z-index:11;
   position:absolute;
   width:100%;
   height:100%;
}

#wrap {
   margin:0 auto;
   width:401px;
   height:453px;
   line-height:453px
}

#wrap img {
   vertical-align:middle;
}
</style> 
 </head> 
 <body> 
  <div id="container"> 
   <!--THIS is the pic in question I'm trying to center--> 
   <div id="logo"> 
    <div id="wrap"> 
     <img src="https://www.java2s.com/style/demo/Opera.png"> 
    </div> 
   </div> 
   <div id="row"> 
    <div class="cell"> 
     <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
    </div> 
    <div class="cell"> 
     <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
    </div> 
    <div class="cell"> 
     <img src="https://www.java2s.com/style/demo/Safari.png"> 
    </div> 
    <div class="cell"> 
     <img src="https://www.java2s.com/style/demo/InternetExplorer.png"> 
    </div> 
   </div> 
  </div>  
 </body>
</html>

Related Tutorials