Revision 494419 of table-layout

  • Revision slug: Web/CSS/table-layout
  • Revision title: table-layout
  • Revision id: 494419
  • Created:
  • Creator: kscarfone
  • Is current revision? No
  • Comment Updated tags

Revision Content

{{CSSRef("CSS Tables")}}

Summary

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

{{cssbox("table-layout")}}

Syntax

Formal syntax: {{csssyntax("table-layout")}}
table-layout: auto
table-layout: fixed

table-layout: inherit

Values

{{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

.contentbox {
  table-layout: fixed;
}

Specifications

Specification Status Comment
{{SpecName('CSS2.1', 'tables.html#width-layout', 'table-layout')}} {{Spec2('CSS2.1')}}  

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}}  - 14.0 +  {{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}} 1.5 {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} 9.8.0 {{CompatUnknown}} 3.0

See also

  • {{CSS_Reference:Table_Properties}}

Revision Source

<div>
 {{CSSRef("CSS Tables")}}</div>
<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>
<p>{{cssbox("table-layout")}}</p>
<h2 id="Syntax" name="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
<a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("table-layout")}}
</pre>
<pre>
table-layout: auto
table-layout: fixed

table-layout: inherit
</pre>
<h3 id="Values" name="Values">Values</h3>
<dl>
 <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>
  <code>fixed</code></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>
<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>{{SpecName('CSS2.1', 'tables.html#width-layout', 'table-layout')}}</td>
   <td>{{Spec2('CSS2.1')}}</td>
   <td>&nbsp;</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}} &nbsp;- 14.0 +&nbsp;</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}} 1.5</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}}</td>
    <td>{{CompatUnknown}} 9.8.0</td>
    <td>{{CompatUnknown}} 3.0</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