How to hide HTML <tr> table row so that it does not take up space?

How to hide HTML <tr> table row so that it does not take up space? I have several <tr> set to style="display:none;" , but they still affect the size of the table, and the border of the table reflects hidden rows.

+79
html css html-table
Jul 17 '09 at 15:46
source share
14 answers

I would really like to see your TABLE style. For example. "Border collapse"

Just guess, but this may affect how hidden lines are displayed.

+31
Jul 17 '09 at 16:08
source share

Can you include the code? I add style="display:none;" to my table rows all the time and effectively hides the whole row.

+72
Jul 17 '09 at 15:53
source share

You can set <tr id="result_tr" style="display: none;"> and then display it using JavaScript:

 var result_style = document.getElementById('result_tr').style; result_style.display = 'table-row'; 
+39
Aug 10 2018-12-12T00:
source share

If display: none; not working, how about setting height: 0; instead of this? In combination with a negative mark (equal to or greater than the height of the upper and lower borders, if any) to further remove the element? I do not think position: absolute; top: 0; left: -4000px; position: absolute; top: 0; left: -4000px; will work, but maybe worth a try.

For my part, using display: none works fine.

+7
Jul 17 '09 at 16:04
source share

I had the same problem, I even added style = "display: none" to each cell.

In the end, I used HTML comments <!-- [HTML] -->

+4
Jun 24 2018-12-12T00:
source share

Add some of the following lines: 0px; font-size: 0px; height: 0px; margin: 0; padding: 0;

I forget who does this. I think this is linear height for IE6.

+3
Jul 17 '09 at 15:59
source share

This happened to me, and I was puzzled by why. Then I noticed that if I removed nbsp; I had inside the lines, then the lines did not take up space.

+2
Dec 03 '09 at 13:21
source share

You can use the style mapping: none with tr to hide, and it will work with all browsers.

+2
May 12 '13 at 21:21
source share
 var result_style = document.getElementById('result_tr').style; result_style.display = ''; 

works great for me.

+1
May 21 '14 at 13:00
source share

You need to put the input type change in a hidden one, all its functions work, but it does not appear on the page

 <input type="hidden" name="" id="" value=""> 

while the input type is set up so that you can change the rest. Good luck

0
Oct 10 '15 at 20:57
source share

HTML:

 <input type="checkbox" id="attraction" checked="checked" onchange="updateMap()">poi.attraction</input> 

JavaScript:

 function updateMap() { map.setOptions({'styles': getStyles() }); } function getStyles() { var styles = []; for (var i=0; i < types.length; i++) { var style = {}; var type = types[i]; var enabled = document.getElementById(type).checked; style['featureType'] = 'poi.' + type; style['elementType'] = 'labels'; style['stylers'] = [{'visibility' : (enabled ? 'on' : 'off') }]; styles.push(style); } return styles; } 
-one
Jul 27 '14 at 3:48
source share

I had the same problem and solved the problem. Css used to be crowded: hidden; Z-index: 999999;

I change it to overflow: visible;

-2
Oct 21 '15 at 6:02
source share

You can set

 <table> <tr style="visibility: hidden"></tr> </table> 
-3
Dec 16 '13 at 12:42 on
source share

position: absolute will remove it from the layout stream and solve your problem - the element will remain in the DOM, but will not affect others.

-four
May 23 '13 at 23:07
source share



All Articles