How hide row in table (without display:none)

孤者浪人 提交于 2019-12-12 03:18:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!