- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I have a table with some blank cells.
example:
<table>
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
<tr><td>5</td><td>6</td><td> </td><td> </td></tr>
<tr><td>a1</td><td>a2</td><td>a3</td>a4<td>a5</td></tr>
</table>
if I hide the empty cell in this way:
table td:empty{display:none;}
the cell is not visible but remains an empty space
you can remove it and do occupy this space to another cell?
thanks
I assume that this is a continuation of your previous question.
As I said there CSS cannot add or remove HTML it can only style it.
What you have found is the drawback of using tables.
You really should be looking into javascript solutions.
You can’t, and shouldn’t, remove empty cells because this will break the table. Every row needs to have the same amount of cells — if it doesn’t, it needs to be compensated by using colspan
on some cells.
Just removing some cells will not work.
If you need tools like this, check out Data Tables. I’ve used them before and they’re pretty great. I know it’s not what you asked for, but it’s my recommendation :)
Thanks for the answers.
How can I fix the problem with javascript empty cells?