You could try using the <col> tag manage table styling for all rows but you will need to set the table-layout:fixed style on the <table> or the tables css class and set the overflow style for the cells

http://www.w3schools.com/TAGS/tag_col.asp

<table class="fixed">
    <col width="20px" />
    <col width="30px" />
    <col width="40px" />
    <tr>
        <td>text</td>
        <td>text</td>
        <td>text</td>
    </tr>
</table>

and this be your CSS

table.fixed { table-layout:fixed; }
table.fixed td { overflow: hidden; }
Answer from hunter on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ html โ€บ html_table_sizes.asp
HTML Table Sizes
Note: Using a percentage as the size unit for a width means how wide will this element be compared to its parent element, which in this case is the <body> element. To set the size of a specific column, add the style attribute on a <th> or <td> element: ... <table style="width:100%"> <tr> <th style="width:70%">Firstname</th> <th>Lastname</th> <th>Age</th> </tr> <tr> <td>Jill</td> <td>Smith</td> <td>50</td> </tr> <tr> <td>Eve</td> <td>Jackson</td> <td>94</td> </tr> </table> Try it Yourself ยป
๐ŸŒ
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: ...
Discussions

Best way to set Column Widths in Table? - HTML & CSS - SitePoint Forums | Web Development & Design Community
What is the best way to set Column Widths in a Table using CSS? Can I just set widths on the in my Header Row and then the in the regular rows below will follow suite? Maybe like thisโ€ฆ Event Name Ticket Price # of Attendees Total ... More on sitepoint.com
๐ŸŒ sitepoint.com
0
September 29, 2011
html - Set the table column width constant regardless of the amount of text in its cells? - Stack Overflow
In my table I set the width of the first cell in a column to be 100px. However, when the text in one of the cell in this column is too long, the width of the column becomes more than 100px. How cou... More on stackoverflow.com
๐ŸŒ stackoverflow.com
Please help! Table width doesn't work (in both HTML and CSS).
I'm not entirely sure what you are looking for/what's wrong, but have you tried using overflow: hidden? I'd suggest posting your code. We can't help you unless you show us what you're having trouble with. More on reddit.com
๐ŸŒ r/web_design
14
2
November 4, 2012
Is there a way - HTML Table - 50% Width on Desktop - 100% width of screen on mobile?
Sure, letโ€™s say you want the table to be 50% width, until the table is at 500px width (or 45rem or whatever), just do width: max(50%, min(500px, 100%)); replace middle value with the one you want. Or use a media query and set a breakpoint, but since youโ€™re a novice using max and min might be easier. More on reddit.com
๐ŸŒ r/css
7
2
April 7, 2022
People also ask

How do I make an HTML table responsive?
To make an HTML table responsive, use percentage-based widths, apply CSS media queries to adjust the layout for smaller screens, and enable overflow for horizontal scrolling when necessary.
๐ŸŒ
dhiwise.com
dhiwise.com โ€บ post โ€บ html-table-width-best-practices-for-a-modern-web-design
How to Set HTML Table Width For Responsive UI: Detailed Guide
What is the role of CSS in responsive table design?
CSS plays a crucial role in responsive table design by allowing you to control widths, apply media queries, and manage layout changes like hiding columns or stacking rows for smaller screens.
๐ŸŒ
dhiwise.com
dhiwise.com โ€บ post โ€บ html-table-width-best-practices-for-a-modern-web-design
How to Set HTML Table Width For Responsive UI: Detailed Guide
Should I use fixed or percentage-based widths for HTML tables?
Itโ€™s best to use percentage-based widths for HTML tables, as they allow the table to adapt to various screen sizes, providing a more responsive and flexible design.
๐ŸŒ
dhiwise.com
dhiwise.com โ€บ post โ€บ html-table-width-best-practices-for-a-modern-web-design
How to Set HTML Table Width For Responsive UI: Detailed Guide
Top answer
1 of 7
286

You could try using the <col> tag manage table styling for all rows but you will need to set the table-layout:fixed style on the <table> or the tables css class and set the overflow style for the cells

http://www.w3schools.com/TAGS/tag_col.asp

<table class="fixed">
    <col width="20px" />
    <col width="30px" />
    <col width="40px" />
    <tr>
        <td>text</td>
        <td>text</td>
        <td>text</td>
    </tr>
</table>

and this be your CSS

table.fixed { table-layout:fixed; }
table.fixed td { overflow: hidden; }
2 of 7
117

Now in HTML5/CSS3 we have better solution for the problem. In my opinion this purely CSS solution is recommended:

table.fixed {table-layout:fixed; width:90px;}/*Setting the table width is important!*/
table.fixed td {overflow:hidden;}/*Hide text outside the cell.*/
table.fixed td:nth-of-type(1) {width:20px;}/*Setting the width of column 1.*/
table.fixed td:nth-of-type(2) {width:30px;}/*Setting the width of column 2.*/
table.fixed td:nth-of-type(3) {width:40px;}/*Setting the width of column 3.*/
<table class="fixed">
    <tr>
        <td>Veryverylongtext</td>
        <td>Actuallythistextismuchlongeeeeeer</td>
        <td>We should use spaces tooooooooooooo</td>
    </tr>
</table>

You need to set the table's width even in haunter's solution. Otherwise it doesn't work.
Also a new CSS3 feature that vsync suggested is: word-break:break-all;. This will break the words without spaces in them to multiple lines too. Just modify the code like this:

table.fixed { table-layout:fixed; width:90px; word-break:break-all;}

Final result

๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ html โ€บ html-table-width-attribute
HTML <table> width Attribute - GeeksforGeeks
July 11, 2025 - The HTML <table> element's width attribute specifies the width of the table. It can accept values in pixels or percentages.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ HTML โ€บ Reference โ€บ Elements โ€บ table
<table>: The Table element - HTML | MDN
November 7, 2025 - vertical-align: CSS property to vertically align table cell content ยท width: CSS property to control the width of the table
Find elsewhere
๐ŸŒ
Bootstrap
getbootstrap.com โ€บ docs โ€บ 4.0 โ€บ content โ€บ tables
Tables ยท Bootstrap
Create responsive tables by wrapping any .table with .table-responsive{-sm|-md|-lg|-xl}, making the table scroll horizontally at each max-width breakpoint of up to (but not including) 576px, 768px, 992px, and 1120px, respectively.
๐ŸŒ
Ironspider
ironspider.ca โ€บ tables โ€บ tablecells3.htm
Table Cells - Width and Height
Web browsers will automatically set the dimensions of the rows and columns in your web page table according to how much content your table cells contain. Since cells are displayed in a grid-like pattern then the cell containing the most content will typically set the width and height of all cells adjacent to it and hence establish the width and height of related rows and columns in your table.
๐ŸŒ
DhiWise
dhiwise.com โ€บ post โ€บ html-table-width-best-practices-for-a-modern-web-design
How to Set HTML Table Width For Responsive UI: Detailed Guide
June 17, 2025 - The Basics of HTML Table Width For Responsive LayoutsUsing CSS for Responsive Table WidthsFixed vs.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ how-to-set-table-width-in-html
How to set table width in HTML?
October 21, 2023 - The attribute is used within the HTML <table> tag, with the CSS property width to set table width.
๐ŸŒ
W3Schools
w3schools.com โ€บ cssref โ€บ pr_tab_table-layout.php
CSS table-layout property
The numbers in the table specify the first browser version that fully supports the property. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] ยท If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] ยท HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
๐ŸŒ
Fandom
community.fandom.com โ€บ f โ€บ p โ€บ 2546344241659906921
HTML Table Width | Fandom
You can see the problem in the ... class="center">Random Name <figure class="article-thumb tright show-info-icon" style="width: 180px"> <figcaption> </figcaption></figure></td> <td>Long description which causes the template ...
๐ŸŒ
SitePoint
sitepoint.com โ€บ html hub โ€บ table sizes
HTML Table Sizes | SitePoint โ€” SitePoint
Set the table width to 100% for mobile and specify a fixed width (e.g., 600px) for larger screens. ... <style> table { width: 100%; border: 1px solid black; } @media (min-width: 600px) { table { width: 600px; } } </style>
๐ŸŒ
SitePoint
sitepoint.com โ€บ html & css
Best way to set Column Widths in Table? - HTML & CSS - SitePoint Forums | Web Development & Design Community
September 29, 2011 - What is the best way to set Column Widths in a Table using CSS? Can I just set widths on the <th> in my Header Row and then the <td> in the regular rows below will follow suite? Maybe like thisโ€ฆ <thead> <tr id="โ€ฆ
๐ŸŒ
HTML.com
html.com โ€บ attributes โ€บ td-width
Stop Using To Set Table Width In HTML: Here's Why ยป
January 24, 2020 - This attribute has been deprecated. Use CSS to control layout of data cells in HTML tables. The width attribute, now deprecated, was once the correct way to adjust the width of a tableโ€™s columns. By default, a browser will adjust table columns to fit the contents of the table.
๐ŸŒ
MDN Web Docs
developer.mozilla.org โ€บ en-US โ€บ docs โ€บ Web โ€บ CSS โ€บ Reference โ€บ Properties โ€บ table-layout
table-layout - CSS | MDN
2 weeks ago - When using this keyword, the table's width needs to be specified explicitly using the width property. If the value of the width property is set to auto or is not specified, the browser uses the automatic table layout algorithm, in which case the fixed value has no effect.
๐ŸŒ
Scaler
scaler.com โ€บ topics โ€บ html-table-width
How to Set HTML Table Width? - Scaler Topics
May 3, 2023 - Find out what is html table width. The HTML table width attribute is used to specify the width of a table or the width of a table cell. The width can be absolute as in pixels or relative as in percentage (%).
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ html โ€บ html-table-sizes
HTML Table Sizes - GeeksforGeeks
August 5, 2025 - Set a width to 50% to a particular column. Example: Implementation to show how to set HTML Table Sizes using width 50% to the <th>.
๐ŸŒ
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>
๐ŸŒ
Tailwind CSS
tailwindcss.com โ€บ docs โ€บ table-layout
table-layout - Tables - Tailwind CSS
Bones (Next Stop, Pottersville)</td> <td>Malcolm Lockyer</td> <td>1961</td> </tr> <tr> <td>Witchy Woman</td> <td>The Eagles</td> <td>1972</td> </tr> <tr> <td>Shining Star</td> <td>Earth, Wind, and Fire</td> <td>1975</td> </tr> </tbody></table> You can manually set the widths for some columns and the rest of the available width will be divided evenly amongst columns without an explicit width.