Set table width, margin and text align : table : Table Style HTML CSS TUTORIALS


HTML CSS TUTORIALS » Table Style » table »

 

Set table width, margin and text align


 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.center {
  text-align: center;
}
.center table {
 width: 50%;
 margin: auto;
 text-align: left;
}
</style>
</head>

<body>

  <h2 id="warning">Lorem ipsum dolor sit amet</h2> 

  <div class="center">
   <table width="50%" border="1" cellpadding="30">
    <tr>
     <td>This is the first cell</td>
     <td>This is the second cell</td>
    </tr>
    <tr>
     <td>This is the third cell, it's under the first cell</td>
     <td>This is the fourth cell, it's under the second cell.</td>
    </tr>
   </table>
  </div>


</body>
</html>

 



HTML code for linking to this page:

Follow Navioo On Twitter

HTML CSS TUTORIALS

 Navioo Table Style
» table