Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Delete empty cells in table

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #192928
    analis
    Participant

    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

    #192948
    Paulie_D
    Member

    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.

    #192954
    Senff
    Participant

    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.

    #192987
    shaneisme
    Participant

    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 :)

    #193053
    analis
    Participant

    Thanks for the answers.

    How can I fix the problem with javascript empty cells?

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.