I have a function that outputs a table like this:
table {
border: 1px solid;
}
td {
width: 30px;
height: 30px;
text-align: center;
//border: 1px solid;
}
<table>
<tr>
<td>2</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>0</td>
</tr>
<tr>
<td>1</td>
<td>2</td>
<td>0</td>
</tr>
I need borders around non-zero elements only. How to achieve that? Is it possible only in CSS?