Forums

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

Home Forums CSS Can you right align entire table cells in a row?

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #278324
    bunkscene
    Participant

    I am trying to hack a third party component with CSS. I can't change the HTML or add JS, so I am looking for a CSS solution. I don't think one is possible.

    I have a simple <table>, with 3 <td>s in each <tr>. There are some cells that are .off. If the first row has all .off cells, I need to remove the row (display: none). If the first row has only 1 or 2 .off cells, I need to right align the remaining cells.

    Using display:none for .off makes the remaining cells left aligned. Using visibility: hidden will not remove the first row if all cells are .off.

    See this for the full example:
    https://jsbin.com/dacusulihu/1/edit?html,output

    #278352
    Beverleyh
    Participant
    #278353
    amirjn
    Participant

    Thanks Beveleyh . It is working

    #278362
    bunkscene
    Participant

    Ah, nice css-trick. I didn’t think to untable the table. This does work well with the caveat that the cells have explicit widths defined. I think in my case, this will work.

    Thanks!

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