CSS table-layout Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Tables

What You’ll Learn

The table-layout property controls how a browser calculates column widths in HTML tables. It helps you choose between content-driven sizing and predictable, performance-friendly layouts.

01

auto

Content-based.

02

fixed

Preset widths.

03

Performance

Faster render.

04

Columns

Width control.

05

table

Set on table.

06

inherit

From parent.

Introduction

The table-layout property in CSS is used to control the layout algorithm used for a table. It can speed up the rendering of large tables by letting the browser determine column widths without scanning every cell’s content.

This property is especially useful when working with tables that have complex content or require consistent column widths.

Definition and Usage

Apply table-layout directly to a <table> element. With auto, the browser sizes columns based on content. With fixed, column widths come from the first row, <col> elements, or explicit width values on cells.

For predictable layouts, set table-layout: fixed and give the table a defined width.

💡
Beginner Tip

Start with the default auto for small tables. Switch to fixed when columns should stay the same width or when a large table feels slow to render.

📝 Syntax

The syntax for the table-layout property is straightforward. It is applied to table elements:

syntax.css
table {
  table-layout: value;
}

Basic Example

fixed-table.css
table {
  width: 100%;
  table-layout: fixed;
}

Syntax Rules

  • Set the property on the <table> element, not individual cells.
  • Use fixed with a table width for reliable column sizing.
  • Define column widths on the first row, <col> elements, or cell width values.
  • The property is not inherited by default, but inherit is a valid keyword.

Related Properties

  • border-collapse — merges table borders
  • width — sets overall table and column sizing
  • word-break — handles long content in fixed cells

🎯 Default Value

The default value of the table-layout property is auto.

⚡ Quick Reference

QuestionAnswer
Default valueauto
Common valuesauto, fixed, inherit
Works withwidth, border-collapse, col elements
Set ontable elements
InheritedNo (unless using inherit)
AnimatableNo

💎 Property Values

ValueExampleDescription
autotable-layout: auto;The browser determines column widths from cell content. Can be slower for large tables because every cell may affect sizing.
fixedtable-layout: fixed;Column widths are determined by the first row, col elements, or cell width values. The browser can render the table faster.
inherittable-layout: inherit;Inherits the table-layout value from the parent element.
auto fixed inherit

When to Use table-layout

table-layout helps you choose the right table rendering strategy:

  • auto — Small tables where content should determine column width naturally.
  • fixed — Dashboards, data grids, and admin panels that need stable column sizes.
  • fixed + width — Large tables where faster initial rendering matters.
  • fixed + ellipsis — Tables with long text that should truncate instead of stretching columns.

If columns look uneven with fixed, set explicit widths on the first row or use <colgroup> and <col> elements.

👀 Live Preview

Compare table-layout: auto and table-layout: fixed with the same cell content. Fixed columns stay equal width; auto columns grow with longer text.

auto layout
Header 1Header 2Header 3
ShortContent 2 with longer textShort
ShortShortContent 6 with even longer text
fixed layout
Header 1Header 2Header 3
ShortContent 2 with longer textShort
ShortShortContent 6 with even longer text

Examples Gallery

Compare auto and fixed layouts, set column widths, build a data table, and handle long cell content with fixed layout.

📜 Table Layout Modes

Demonstrate the difference between auto and fixed table layouts — matching the reference example.

Example 1 — Auto vs fixed table layouts

In this example, we’ll demonstrate the difference between auto and fixed table layouts on two similar tables.

index.html
<style>
  table {
    width: 100%;
    border-collapse: collapse;
  }
  .auto-layout { table-layout: auto; }
  .fixed-layout { table-layout: fixed; }
  .fixed-layout th, .fixed-layout td { width: 100px; }
</style>

<table class="auto-layout">...</table>
<table class="fixed-layout">...</table>
Try It Yourself

How It Works

With auto, the browser reads all cell content to size columns. With fixed, it uses the widths you define on the first row.

Example 2 — Fixed layout with column widths

Use table-layout: fixed with explicit column widths for a predictable dashboard table.

dashboard-table.css
.dashboard-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

.dashboard-table col.name { width: 30%; }
.dashboard-table col.status { width: 20%; }
.dashboard-table col.notes { width: 50%; }
Try It Yourself

How It Works

<col> elements give you clean column width control without repeating width on every cell.

📄 Practical Use Cases

Choose auto for flexible content or fixed when you need stable columns and overflow handling.

Example 3 — Auto layout for content-driven columns

Keep the default auto layout when column widths should adapt to the longest cell content.

auto-table.css
.product-table {
  table-layout: auto;
  border-collapse: collapse;
}
Try It Yourself

How It Works

Auto layout is ideal for small comparison tables, pricing tables, and simple data lists with varying text lengths.

Example 4 — Fixed layout with truncated long text

Combine table-layout: fixed with text-overflow: ellipsis so long cell content does not stretch the table.

ellipsis-table.css
.compact-table {
  width: 100%;
  table-layout: fixed;
}

.compact-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
Try It Yourself

How It Works

Fixed layout locks column widths, and overflow styles keep the table visually compact on narrow screens.

table-layout in the family

table-layout controls how columns are sized, but good table styling usually combines it with border-collapse for clean borders and a table width so fixed columns have a reference size.

styled-table.css
table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

🧠 How table-layout Works

1

Browser reads the table

The table element and its rows, columns, and cells form the layout structure.

Structure
2

Layout algorithm is chosen

auto scans content for widths. fixed uses the first row and width rules.

Algorithm
3

Columns are sized

Cells render inside the calculated column widths. Fixed mode can render before all content loads.

Sizing
=

Predictable table layout

You control whether columns follow content or stay locked to your design.

Browser Compatibility

The table-layout property is well supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is also supported in older browsers, making it a reliable property for cross-browser compatibility.

Baseline · Universal support

Reliable across browsers

table-layout has been supported for many years in Chrome, Firefox, Safari, Edge, and Opera.

99% Modern browser support
Google Chrome 1+ · Desktop & Mobile
Full support
Mozilla Firefox 1+ · Desktop & Mobile
Full support
Apple Safari 1+ · macOS & iOS
Full support
Microsoft Edge 12+ · All versions
Full support
Opera 4+ · Modern versions
Full support

Testing tip

Resize the browser window and compare the same table with auto and fixed to see how column behavior changes.

table-layout property 99% supported

Bottom line: table-layout is safe to use in virtually all projects that include HTML tables.

Conclusion

The table-layout property is a valuable tool for web developers when working with tables, allowing for more control over how tables are rendered.

By using the fixed value, you can improve the rendering performance of large tables and create a more predictable layout. Experiment with different values to see how they affect your tables and choose the one that best suits your needs.

💡 Best Practices

✅ Do

  • Use fixed for large data tables and admin dashboards
  • Set a table width when using table-layout: fixed
  • Define column widths on the first row or with <col> elements
  • Pair fixed layout with ellipsis for long text in cells
  • Keep auto for small, content-flexible tables

❌ Don’t

  • Expect fixed to work well without any column width hints
  • Apply table-layout to individual cells instead of the table
  • Assume fixed layout improves performance if every column still has huge unbroken text
  • Forget accessibility — truncated text may need a title attribute or expandable row

Key Takeaways

Knowledge Unlocked

Five things to remember about table-layout

Use these points when building your next HTML table.

5
Core concepts
02

fixed

Preset columns.

Mode
03

table element

Set here only.

Target
04

Performance

Fixed is faster.

Benefit
🔄 05

border-collapse

Pair for styling.

Companion

❓ Frequently Asked Questions

table-layout controls the algorithm the browser uses to size table columns. It is set on the table element itself.
auto sizes columns based on cell content, which can be slower for large tables. fixed uses column widths from the first row or explicit width values for faster, more predictable layouts.
The default value is auto.
Use fixed when you want equal or predefined column widths, faster rendering on large tables, or consistent layouts regardless of cell content length.
No. table-layout only applies to table elements such as table, not to divs styled with display: table unless they use the table display type.

Practice in the Live Editor

Open the HTML editor and try table-layout: fixed; on a table with defined column widths.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful