You can set the width of a table column using the CSS width property of the col element. The width value is most commonly specified in pixels (width: 200px;), or as a percentage of the width of the parent element (width: 50%;). Example with inline style attribute:

<table style="width: 100%">
    <colgroup>
       <col span="1" style="width: 15%;">
       <col span="1" style="width: 70%;">
       <col span="1" style="width: 15%;">
    </colgroup>
    
    
    
    <!-- Put <thead>, <tbody>, and <tr>'s here! -->
    <tbody>
        <tr>
            <td style="background-color: #777">15%</td>
            <td style="background-color: #aaa">70%</td>
            <td style="background-color: #777">15%</td>
        </tr>
    </tbody>
</table>

Answer from Gordon Gustafson on Stack Overflow
🌐
W3Schools
w3schools.com › htmL › html_table_sizes.asp
HTML Table Sizes
<table style="width:100%"> <tr> ... case is the <body> element. To set the size of a specific column, add the style attribute on a <th> or <td> element:...
Discussions

Set a table columns width - HTML & CSS - SitePoint Forums | Web Development & Design Community
Hi, I tried to do it by adjusting the width: Sample Page More on sitepoint.com
🌐 sitepoint.com
0
March 9, 2012
How to make a 100% width table with all columns fitting their content, except one column which hides its overflow
I'm sure there's some magical combination of min-width, width, max-width that lets you do something like this. Does anyone know what I'm talking about? I was sure there was too, but a quick play with it and I can't get it to work exactly as you want. Does it need to be a table? A with a grid layout is far easier to get the look you want with. More on reddit.com
🌐 r/csshelp
9
3
November 15, 2024
Formatting html table -> force the column width
I am facing an issue that when the value of the cell is too long, it will automatic make my column width wider, and the last column's value will disappear · but i want to fix the column width , if the word is too long, it woll automatically turn to new line, so the format can be more neat. More on community.powerplatform.com
🌐 community.powerplatform.com
May 17, 2023
How do I adjust column width on tables?

Instead of using percentage, add a static value to .link .usertext .md table td { width: } in your stylesheet.

It's at 25% now, try with 120px and see how that looks.

More on reddit.com
🌐 r/csshelp
2
1
May 5, 2015
🌐
CodePen
codepen.io › danichk › pen › ZpeQZq
Taming table column widths
/** * Taming table column widths */ body { background: #ddd } section { width: 500px; margin: 2em; background: white; } table { border-collapse: collapse; margin-bottom: 1em; width: 100%; } section + section table { table-layout: fixed } td ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › col
<col>: The Table Column element - HTML | MDN
Set a to zero and b to the position of the column in the table, e.g., td:nth-of-type(2) { vertical-align: middle; } to center the second column cells vertically. If the table does use a colspan attribute, the effect can be achieved by combining adequate CSS attribute selectors like [colspan=n], though this is not trivial. ... Specifies a default width for each column.
🌐
Tailwind CSS
tailwindcss.com › docs › width
width - Sizing - Tailwind CSS
Use w-full or w-<fraction> utilities like w-1/2 and w-2/5 to give an element a percentage-based width:
🌐
Symphony
support.symphony.com › hc › en-us › articles › 360016442352-Amend-the-column-width-of-an-HTML-table
Amend the column width of an HTML table – Symphony Help Center
<messageML><card accent='tempo-bg-color--blue'> <header>Example Heading</header> <body>Example:<br/><div><table style='border-collapse:collapse;table-layout:auto;width:100%'><thead> <tr><th>Key</th><th>Description</th></tr> </thead> <tr><td style='width:10%'>1</td><td>Analyst Meeting 1-1</td></tr> <tr><td style='width:10%'>2</td><td>Analyst Meeting 2-1</td></tr> <tr><td style='width:10%'>3</td><td>Analyst Meeting Group</td></tr> <tr><td style='width:10%'>4</td><td>Bespoke Work</td></tr> <tr><td style='width:10%'>5</td><td>Chat/Email</td></tr> <tr><td style='width:10%'>6</td><td>Corporate Acces
Find elsewhere
🌐
W3Schools
w3schools.com › html › html_table_headers.asp
HTML Table Headers
HTML tables can have headers for each column or row, or for many columns/rows.
🌐
SitePoint
sitepoint.com › html hub › table sizes
HTML Table Sizes | SitePoint — SitePoint
Learn how to adjust HTML table sizes, control column and row dimensions, and create responsive layouts. Explore examples for fixed and flexible table designs.
🌐
SitePoint
sitepoint.com › html & css
Set a table columns width - HTML & CSS - SitePoint Forums | Web Development & Design Community
March 9, 2012 - Hi, I tried to do it by adjusting the <td> width: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Sample Page</title> <style type="text/css"> …
🌐
GeeksforGeeks
geeksforgeeks.org › html › how-to-fix-the-width-of-columns-in-the-table
How to fix the width of columns in the table ? - GeeksforGeeks
September 9, 2024 - If the fixed width is insufficient, the first column may overflow and behave like the others. ... <!DOCTYPE html> <html> <head> <style> table { margin-left: auto; margin-right: auto; font-size: 20px; height: 100%; table-layout: fixed; } td { border: 1px solid black; text-align: center; padding: 10px; } tr:nth-child(even) { background-color: #00cf45; } h1 { color: green; } </style> </head> <body> <center> <h1>GeeksforGeeks</h1> <h2> To fix the width of columns in the table </h2> <table> <tr style="color:white; background-color:black;"> <td width="100px">Col1</td> <td>Col2</td> <td>Col3</td> </t
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › CSS › Reference › Properties › table-layout
table-layout - CSS | MDN
Otherwise, the column gets the width from the shared remaining horizontal space. With this algorithm 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 might not fit in the column widths provided.
🌐
GeeksforGeeks
geeksforgeeks.org › html › how-to-set-table-cell-width-height-in-html
How to Set Table Cell Width & Height in HTML ? - GeeksforGeeks
July 23, 2025 - Example: In the below example we are using inline styling to set table cell width and height. ... <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Table Cell Width and Height</title> </head> <body> <h1 style="color: green;">GeeksForGeeks</h1> <h3> Set width and height of table cell using Inline Styling </h3> <table border="1"> <tr> <th>col 1</th> <th>col 2</th> </tr> <tr> <td style="width: 100px; height: 50px;"> Cell 1 with 100px width </td> <td style="width: 200px; height: 50px;"> Cell 2 with 200px width </td> </tr> </table> </body> </html>
🌐
Ant Design
ant.design › components › table
Table - Ant Design
Table column title supports colSpan that set in column. Table cell supports colSpan and rowSpan that set in onCell return object. When each of them is set to 0, the cell will not be rendered. ... Display tree structure data in Table when there is field key children in dataSource, try to customize childrenColumnName property to avoid tree table structure. You can control the indent width by setting indentSize.
🌐
Reddit
reddit.com › r/csshelp › how to make a 100% width table with all columns fitting their content, except one column which hides its overflow
r/csshelp on Reddit: How to make a 100% width table with all columns fitting their content, except one column which hides its overflow
November 15, 2024 -

I'm sure I managed to do this once before, but I can't figure it out now. I want to make a table (yes, an actual <table> table) that fills (without overflowing) its parent in width, with all column cells tightly fitting their non-wrapping content, except for the second column which should fill any remaining width but hide any overflow of its content.

e.g.:

Col1 Col2 Col3 Col4
ABC This column should take up... ABCDEF More_info
1234 any remaining space availab... blahblahetc Yadayadayada
- while hiding any overflow o... onetwothree XYZ

I'm sure there's some magical combination of min-width, width, max-width that lets you do something like this. Does anyone know what I'm talking about?


Edit: the solution is:

Table: width:100%;
Flexible TD: overflow:hidden; max-width:0px;
All other TDs: width:0px;

🌐
W3Schools
w3schools.com › css › css_table_size.asp
CSS Table Size (Width and Height)
The CSS width property is used to set the width of a table. ... The CSS height property is used to set the height of a table. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › HTML › Reference › Elements › table
<table>: The Table element - HTML | MDN
Specifies the width of the table. Use the width CSS property instead, as this attribute is deprecated. Note: While no HTML specification includes height as a <table> attribute, some browsers support a non-standard interpretation of height. The unitless value sets a minimum absolute height in pixels.
🌐
Microsoft Power Platform
community.powerplatform.com › forums › thread › details
Formatting html table -> force the column width
May 17, 2023 - I am facing an issue that when the value of the cell is too long, it will automatic make my column width wider, and the last column's value will disappear · but i want to fix the column width , if the word is too long, it woll automatically turn to new line, so the format can be more neat.
🌐
Markdown Guide
markdownguide.org › extended-syntax
Extended Syntax | Markdown Guide
To add a table, use three or more hyphens (---) to create each column’s header, and use pipes (|) to separate each column. For compatibility, you should also add a pipe on either end of the row. | Syntax | Description | | ----------- | ----------- | | Header | Title | | Paragraph | Text | ... Cell widths can vary, as shown below.
🌐
GeeksforGeeks
geeksforgeeks.org › html › html-dom-table-width-property
HTML | DOM Table width Property - GeeksforGeeks
May 30, 2022 - The Table width property in HTML DOM is used to set or return the value of the width attribute of a table.
🌐
CSS-Tricks
css-tricks.com › faking-min-width-on-a-table-column
Faking Min Width on a Table Column | CSS-Tricks
January 10, 2023 - I imagine we could throw an aria-hidden attribute on the unused column, but also know ARIA isn’t a substitute for poor HTML. I’ll admit, this feels a little, um, hacky. But it does work! Let me know if you have a different approach in the comments… or know of any confusions this “hack” might bring to our users. ... The empty col feels like it breaks the semantics of the table a bit. Another possible solution would be to use max and calc with vw units to determine the size of the first column – something like: .col-200 { width: max(200px, calc(100vw - 680px)); }