Making a zero-width and zero-height table element

spamsk8r

Golden Member
Jul 11, 2001
1,787
0
76
So I'm building an html table, but I want to hide a full column. I.e., I do not want it to display, nor do I want it to take up space. It does, however, have data in it. I just don't want the user to see it (it has to be done this way as per orders from on high, and no this has nothing to do with any kind of homework). On all the elements in the column I've set the style as follows:

td.hiddenValue {
display: none;
width: 0px;
height: 0px;
}

But it's not working. Now, I'm not any kind of CSS guru (heck, I'm not even really a web designer, I just write backend code for the most part) so maybe I'm missing something simple here? Or is it just not possible to do? Any suggestions would be great, and please, if I can clarify any further let me know. Thanks in advance.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Just setting display to none should make the td disappear completely. What exactly is it doing instead?


I assume all the td's in the 'column' have their class set to 'hiddenValue'? Any other css relating to td's that might be overriding it?
 

spamsk8r

Golden Member
Jul 11, 2001
1,787
0
76
Now that I look at it further, it seems that there's not a problem with the columns, but with the rows. Is it possible to hide a table row? It would seem not, since I attempted to set display: none; on a TR element and it rendered it anyway. Hrm, looks like I'm going to have to find a different way of doing this (the reason I can't just apply display: none; to all the TDs is that the table is generated by JavaServer Faces, so I don't have total control over it, and no direct access to style the TD elements (only the SPANs within the TDs). Thanks for the help, I'm going to have to rethink this whole thing.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
That's odd. style='display:none' seems to work on a TR for me, as does setting element.style.display='none' in JS or in a stylesheet.
 

spamsk8r

Golden Member
Jul 11, 2001
1,787
0
76
I figured it out. Another CSS rule was cascading down and causing havoc with my rules. Thanks for the help.