Master W3Schools Table Column Width: Complete Guide

Logan Jul 13, 2026

Looking to control the width of columns in HTML tables? W3Schools provides a comprehensive guide on how to achieve this, ensuring your data is neatly organized and presented. Let's delve into adjusting table column widths using CSS and the HTML tag.

Blank 4 Column Table Printable
Blank 4 Column Table Printable

Tables are a fundamental aspect of web design, enabling you to display information in an easy-to-understand format. However, default table styling can sometimes lead to awkward column widths. Luckily, W3Schools has step-by-step tutorials to help you customize table layouts.

4 Column Paper - 10 Free PDF Printables | Printablee
4 Column Paper - 10 Free PDF Printables | Printablee

Using CSS to Set Column Width

Cascading Style Sheets (CSS) offers a straightforward method to control column width. You can set the width of a single cell, a row of cells, a column, or the entire table.

an image of a table with three sections
an image of a table with three sections

Here's an example using CSS to set the width of the second column to 500 pixels:

```css

Company Model Year
Ford Mustang 2021
BMW X5 2022

Column Template 5 Columns - 10 Free PDF Printables | Printablee
Column Template 5 Columns - 10 Free PDF Printables | Printablee

```

Setting Width as a Percentage

Instead of pixels, you can also use percentages to set column widths. This ensures your table adapts to different screen sizes. In this example, the first and third columns will each occupy 25% of the table's width, while the second column takes up the remaining 50%:

```css

Company Model Year
Ford Mustang 2021
BMW X5 2022

a table with different colors on it and the number of each item in front of it
a table with different colors on it and the number of each item in front of it

```

Auto-sizing Columns

If you prefer to let your content dictate column widths, you can use the auto value in CSS. This tells the browser to size the column based on the longest cell's contents:

```css

Company Model Year
Ford Mustang 2021
BMW X5 2022

a red and white sign with the number of people in each column, which has been placed
a red and white sign with the number of people in each column, which has been placed

```

Using the Tag to Set Column Width

The tag, placed inside the tag, enables you to set attributes for a group of columns. This is particularly useful when dealing with multiple columns that share the same width.

the printable worksheet for count rows and columns
the printable worksheet for count rows and columns
Precisely Adjusting Table Column Widths
Precisely Adjusting Table Column Widths
Difference Between Row and Column | Compare the Difference Between Similar Terms
Difference Between Row and Column | Compare the Difference Between Similar Terms
a sheet of paper with lines on it
a sheet of paper with lines on it
Blank 5 Column Chart Templates
Blank 5 Column Chart Templates
4 Column Sheet - 10 Free PDF Printables | Printablee
4 Column Sheet - 10 Free PDF Printables | Printablee
Table 3-Column
Table 3-Column
Free Printable Column Paper
Free Printable Column Paper
Blank 6 Column Chart Templates
Blank 6 Column Chart Templates
a spreadsheet is shown in the form of a blank sheet
a spreadsheet is shown in the form of a blank sheet
Lined Column Paper Template - 13 Free PDF Printables | Printablee
Lined Column Paper Template - 13 Free PDF Printables | Printablee
a four paneled white board with green background
a four paneled white board with green background
Printable Landscape Style 6 Column Chart
Printable Landscape Style 6 Column Chart
Pinterest
Pinterest
Blank Columns Templates - 10 Free PDF Printables | Printablee
Blank Columns Templates - 10 Free PDF Printables | Printablee
Printable Blank 6 Column Chart Templates - FREE 6 Column Tables
Printable Blank 6 Column Chart Templates - FREE 6 Column Tables
Blank 2 Column Chart Templates
Blank 2 Column Chart Templates
an image of a blank paper with color swats on the top and bottom half
an image of a blank paper with color swats on the top and bottom half
a blank sheet with three sections for each side and one section on the other side
a blank sheet with three sections for each side and one section on the other side
Blank 4 Column Chart Templates
Blank 4 Column Chart Templates

Setting a Single Column Width

To apply width styles to a specific column, place the tag between the tags. In this example, the second column is set to a width of 500 pixels:

```html

Company Model Year
Ford Mustang 2021
BMW X5 2022

```

Setting Multiple Column Widths

You can also apply styles to multiple columns by increasing the number of tags. In this case, the first and third columns will each occupy 25%, while the second column takes up 50% of the table's width:

```html

Company Model Year
Ford Mustang 2021
BMW X5 2022

```

Mastering table column widths is a crucial skill in web development. By utilizing CSS and the tag, you can customize your tables to match your specific design needs. W3Schools offers a wealth of resources to help you become a table layout pro. Happy coding!