问题
I need to hide row in html table. But I can't use property display: none
.
Reason - we use tablesorter
plugin with widgets staticRow
and scroller
and when we hide rows with display: none
we have troubles with incorrect width in header and in table cells.
We discovered that problem is in display: none
. We tried to use set from several properties for hiding rows
tr.hide, tr.hide td {
visibility: hidden;
height: 0;
line-height: 0;
font-size: 0;
padding 0;
}
But this row still have height (not so big as in other cells in table, but still have).
I added 2 examples to jsfiddle (first - with class, which I add above, second - with display:none
), you can see difference.
UPD: I added
box-sizing: border-box;
And allmost solved my problem, but still exists 1-2 pixels instead of empty row.
UPD2: border-spacing: 0
for table remove this extra spacing
回答1:
I am not sure if that's what you want, but you can add the attribute cellspacing="0"
for the table. With css you can use.
#second_table { border-spacing:0;}
来源:https://stackoverflow.com/questions/34344198/how-hide-row-in-table-without-displaynone