HTML Table width in percentage, table rows separated equally

Use the property table-layout:fixed; on the table to get equally spaced cells. If a column has a width set, then no matter what the content is, it will be the specified width. Columns without a width set will divide whatever room is left over among themselves. <table style=”table-layout:fixed;”> <tbody> <tr> <td>gobble de gook</td> <td>mibs</td> </tr> … Read more

Insert th in thead

You can also use the insertCell method as originally requested. You just have to change the outerHTML to overwrite the <td> created by the insertCell method: var table = document.createElement(“TABLE”) var row = table.insertRow(0); row.insertCell(0).outerHTML = “<th>First</th>”; // rather than innerHTML To match the example given: HTML <table id=”table”> <thead> <tr> <th>First</th> </tr> <thead> </table> … Read more

CSS width and max-width combined

Add display: block; to the table element’s style attribute (preferably in a CSS file or the <style> section of the document rather than as in inline style). <div> elements have display: block by default, while <table> elements have display: table; by default. Your problem is that the max-width property only applies to block elements, so … Read more

scroll bar for a table cell

Yes you can do that. The easiest way is to put inside your cell a div filling it and set its overflow style property. CSS : div.scrollable { width: 100%; height: 100%; margin: 0; padding: 0; overflow: auto; } HTML : <td><div class=scrollable> Some content with a scrollbar if it’s too big for the cell … Read more