tags:

views:

2891

answers:

6

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

+1  A: 

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

Calvin L
A: 

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

I forget which one does it. I think it's line-height for IE6.

s_hewitt
A: 

If display: none; doesn't work, how about setting height: 0; instead? In conjunction with a negative margin (equal to, or greater than, the height of the top and bottom borders, if any) to further remove the element? I don't imagine that position: absolute; top: 0; left: -4000px; would work, but it might be worth a try.

For my part, using display: none works fine.

David Thomas
+3  A: 

I would really like to see your TABLE's styling. E.g. "border-collapse"

Just a guess, but it might affect how 'hidden' rows are being rendered.

o.k.w
Thanks! That was the missing style.
MikeN
A: 

This happened to me and I was baffled as to why. Then I noticed that if i removed any nbsp; i had within the rows, then the rows didn't take up any space.

Kevin H
A: 

Present Address " maxlength="40" style="width: 200px" /> " maxlength="40" style="width: 200px" />

I am not able to figure out that the previous row of 174 matches with the next row of 182 in perfect how to get rid of this problem

raj
Hi, welcome at Stackoverflow :) Please post questions as questions by pressing `Ask Question` button at the right top. Do not post questions as answers. Please also read the right hand column of the message editor how to format code. Oh, please also do not expect answers by mail, this makes no utter sense. I've removed your mailadress to save you from spambots.
BalusC