Center a fixed, table display div without setting a width - HTML CSS CSS Widget

HTML CSS examples for CSS Widget:Div Table

Description

Center a fixed, table display div without setting a width

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <title>Lorem ipsum dol</title> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <style id="compiled-css" type="text/css">
div {<!--  w  ww . j a  va 2s  . com-->
   text-align:center;
   position:fixed;
   left:0;
   right:0;
   margin:auto;
}

span {
   border:2px solid Chartreuse;
}
</style> 
 </head> 
 <body> 
  <div class="center"> 
   <span>Lorem ipsum dol</span> 
  </div>  
 </body>
</html>

Related Tutorials