Want to share your CSS expertise with others? Apply to the MDN Fellowship by April 1! http://mzl.la/MDNFellowship

mozilla

Revision 239002 of table-layout

  • Revision slug: CSS/table-layout
  • Revision title: table-layout
  • Revision id: 239002
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The table-layout CSS property defines the algorithm to be used to layout the table cells, rows, and columns.

  • {{ Xref_cssinitial() }}: {{ Cssxref("auto") }}
  • Applies to: 'table' and 'inline-table' elements
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

table-layout: inherit | auto | fixed 

Values

{{ Cssxref("inherit") }}
{{ Cssxref("auto") }}
An automatic table layout algorithm is commonly used by most browsers for table layout. The width of the table and its cells depends on the content thereof.
fixed
Table and column widths are set by the widths of table and col elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.

Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content may not fit in the column widths provided. Any cell that has content that overflows uses the {{ Cssxref("overflow") }} property to determine whether to clip the overflow content.

Examples

{{ CSSLiveSample('table-layout.html') }}

.contentbox {
  table-layout: fixed;
}

Specifications

Specification Status Comment
CSS 2.1 {{ Spec2('CSS2.1') }}  

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{ CompatUnknown() }} {{ CompatGeckoDesktop("1") }} 5.0 7.0 1.0
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

  • {{ CSS_Reference:Table_Properties() }}

Revision Source

<p>
  {{ CSSRef() }}</p>
<h2 id="Summary" name="Summary">Summary</h2>
<p>The <code>table-layout</code> CSS property defines the algorithm to be used to layout the table cells, rows, and columns.</p>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}:</dfn> {{ Cssxref("auto") }}</li>
  <li><dfn>Applies to:</dfn> 'table' and 'inline-table' elements</li>
  <li><dfn>{{ Xref_cssinherited() }}:</dfn> no</li>
  <li><dfn>Media:</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}:</dfn> as specified</li>
</ul>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="eval">table-layout: inherit | auto | fixed 
</pre>
<h3 id="Values" name="Values">Values</h3>
<dl>
  <dt>
    {{ Cssxref("inherit") }}</dt>
  <dt>
    {{ Cssxref("auto") }}</dt>
  <dd>
    An automatic table layout algorithm is commonly used by most browsers for table layout. The width of the table and its cells depends on the content thereof.</dd>
  <dt>
    fixed</dt>
  <dd>
    Table and column widths are set by the widths of<code> table </code>and<code> col </code>elements or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.<br>
    <br>
    Under the "fixed" layout method, the entire table can be rendered once the first table row has been downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content may not fit in the column widths provided. Any cell that has content that overflows uses the {{ Cssxref("overflow") }} property to determine whether to clip the overflow content.</dd>
</dl>
<h2 id="Examples" name="Examples">Examples</h2>
<p>{{ CSSLiveSample('table-layout.html') }}</p>
<pre class="Brush: css">.contentbox {
  table-layout: fixed;
}
</pre>
<h2 id="Specifications" name="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="external" href="http://www.w3.org/TR/CSS21/tables.html#width-layout" title="http://www.w3.org/TR/CSS21/tables.html#width-layout">CSS 2.1</a></td>
      <td>{{ Spec2('CSS2.1') }}</td>
      <td> </td>
    </tr>
  </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Chrome</th>
        <th>Firefox (Gecko)</th>
        <th>Internet Explorer</th>
        <th>Opera</th>
        <th>Safari</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatGeckoDesktop("1") }}</td>
        <td>5.0</td>
        <td>7.0</td>
        <td>1.0</td>
      </tr>
    </tbody>
  </table>
</div>
<div id="compat-mobile">
  <table class="compat-table">
    <tbody>
      <tr>
        <th>Feature</th>
        <th>Android</th>
        <th>Chrome for Android</th>
        <th>Firefox Mobile (Gecko)</th>
        <th>IE Mobile</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also" name="See_also">See also</h2>
<ul><li>{{ CSS_Reference:Table_Properties() }}</li></ul>
Revert to this revision