I am a relative newbie to web programming, so I probably make some obvious mistakes here.
When I try to hide a row in a table from javascript, for example rows [i] .style.display = 'none', the table layout is completely destroyed. Initially, the contents of the cell were wrapped, and the width of the table became more and more compressed. Then I added style = "table-layout: fixed" in the table tag and style = "white-space: nowrap" in each td. This stopped line wrapping, but the content was not line-aligned. Cells began to move to the left if the space and width of the column varied from one row to another. Then I added a fixed width to each of the th and td elements, as well as to the div containing the table. Nevertheless, the problem remained.
My current HTML is something like the following.
<div style="width: 300px">
<table id="errorTable" width="100%" cellpadding="5" cellspacing="2" style="table-layout: fixed">
<tr id="HeaderRow">
<th style="width: 100px;">Header 1</th>
<th style="width: 50px;">Header 2</th>
<th style="width: 150px;">Header 3</th>
</tr>
<tr id="DetailRow1">
<td style="white-space:nowrap; width: 100px;">Data 1_1 in Row 1</td>
<td style="white-space:nowrap; width: 50px;">Data 1_2 in Row 1</td>
<td style="white-space:nowrap; width: 150px;">Data 1_3 in Row 1</td>
</tr>
<tr id="DetailRow2">
<td style="white-space:nowrap; width: 100px;">Data 2</td>
<td style="white-space:nowrap; width: 50px;">Data 2</td>
<td style="white-space:nowrap; width: 150px;">Data 2</td>
</tr>
<tr id="DetailRow3">
<td style="white-space:nowrap; width: 100px;">Data 3_1</td>
<td style="white-space:nowrap; width: 50px;">Data 3_2</td>
<td style="white-space:nowrap; width: 150px;">Data 3_3</td>
</tr>
</table>
</div>
, , 100, 50 150 . , , , 100, 50 150, . , 300 px. , , , .
, , .
.