This code is working on browsers other than IE:
table.tbl.tr.td:first-child { display: none; }
What shall I use for to make it work on all browsers?
Usually, to hide an element from view, you use the 'display' property and set it to 'none'. But CSS also has a property called 'visibility', which hides elements in a different way. In particular, we use 'visibility: collapse' here, which is designed especially for hiding table columns and rows.
To hide a column entirely from view, meaning it will not be displayed in either the normal or details row, simply use the visible column option and set it to false . This example shows a table where the first column ID is completely hidden from view using the data-visible column attribute.
The syntax is :nth-child(an+b), where you replace a and b by numbers of your choice. For instance, :nth-child(3n+1) selects the 1st, 4th, 7th etc. child.
Your expression above won't work at all. table.tbl.tr.td
will select a table element that is defined like this: <table class="tbl tr td">
but not its cells.
It should be like this and the :first-child
selector is supported in pretty much all browsers above Internet Explorer 6:
table.tbl tr td:first-child { display: none; }
Unfortunately, older versions of IE do not support :first-child in CSS. Don't know about IE8. Anyways, if you don't want to do javascript, and you have access to the html, it's pretty easy to assign a "first" class to the first column tds in the table. So the html will look like:
<table>
<tr>
<td class="first">...</td>
<td>..</td>
..
</tr>
</table>
You can then create a css entry like:
table td.first { display: none; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With