I am showing results in a Table in a grid form. There is an ID column. Is there anyway through HTML or CSS that I can hide the first column?
A:
Maiku Mori
2009-10-25 13:26:24
+2
A:
<colgroup>
lookes promising, but in fact it doesn't allow too much CSS support - many CSS attrubutes simply don't apply with colgroup: http://www.w3schools.com/tags/tag_colgroup.asp
Another option is advanced CSS selectors, like +
or :nth-child
, but they aren't supported by an older browser.
Your best bet is to add a class to that column, or to use JavaScript.
Kobi
2009-10-25 13:30:53
+1
A:
add the "display:none;" style to a <col>
element corresponding to the column. If you want to show the column later, add an id to the <col>
.
<table>
<col id="x" style="display:none" />
<col />
<col />
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
<script>
function showColumn() {
document.getElementById("x").style.display = "";
}
</script>
Ray
2009-10-25 13:36:21
As I've almost stated in my answer, this doesn't work cross-browser. A quick check confirms it doesn't work on Firefox and Chrome: http://jsbin.com/avega
Kobi
2009-10-25 14:02:59