The CSS reference

"table-layout" - css property (v. css 2)

  • Indicates the layout algorithm to be used for a table
  • Initial value: auto
  • The property is not inherited
  • HTML usage: 'table' and 'inline-table' elements
  • Browsers that support the table-layout - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible table-layout values:

Values Comments CSS
auto Use any automatic table layout algorithm 2
fixed Use the fixed table layout algorithm. The horizontal layout of the table does not depend on the contents of the cells; it only depends on the table's width, the width of the columns, and borders or cell spacing. 2
inherit Will inherit the value from parent specification. 2

Property "table-layout" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <script type="text/javascript" >
    </script>
    <style   type="text/css">
      .fixed {table-layout: fixed;}
      table { height: 100px; width:300px; }
      td { border: 10px #aad5ff inset;}
     </style>
  </head>
  <body >
    <table class="fixed" >
      <tr >
        <td >This table </td>
        <td >has a</td>
        <td >fixed table-layout</td>
      </tr>
    </table>
    <br/>
    <table  >
      <tr >
        <td >This table </td>
        <td >has a</td>
        <td >auto table-layout</td>
      </tr>
    </table>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.tableLayout="table-layout value"
// To GET values you must first get the computed style object
// To get that object in IE or Opera:
var cStyle=[o].currentStyle;
// To get that object in Firefox, Chrome or Safari (w3c-type):
var cStyle=window.getComputedStyle([o],null)
// To GET the property value:;
var value=cStyle.tableLayout;
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.