Center a table in the page - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Table

Description

Center a table in the page

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">
#mytable<!--from   w ww  . ja v a 2s.  c  o m-->
 {
   position:fixed;
   left:51%;
   top:51%;
}
</style> 
 </head> 
 <body> 
  <table border="1" id="mytable"> 
   <tbody> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem</td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem</td> 
    </tr> 
    <tr> 
     <td>Lorem</td> 
     <td>Lorem</td> 
    </tr> 
   </tbody> 
  </table> 
  <table> 
  </table>  
 </body>
</html>

Related Tutorials