• Resolved dbizzle

    (@darsunrb)


    Hi Tobias,

    I use custom css to center all the cells I need like this:
    .tablepress-id-20 .row-1 .column-1,
    .tablepress-id-20 .row-1 .column-2,
    .tablepress-id-20 .row-1 .column-3,
    .tablepress-id-20 .row-1 .column-4,
    .tablepress-id-20 .row-1 .column-5,
    .tablepress-id-20 .row-1 .column-6,
    .tablepress-id-20 .row-1 .column-7,
    .tablepress-id-20 .row-1 .column-8,
    .tablepress-id-20 .row-1 .column-9 {
    text-align: center;
    }

    etc. and it works fine no problem. But because I need it to be done to every cell in my table sometimes it’s a bit time consuming when I have so many rows and columns.

    Is there a simple bit of code that I can add to the custom css that will center every single cell in the given table id, without having to do it like above?

    Thanks for your time and cheers for your hard work ??

    https://www.ads-software.com/plugins/tablepress/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter dbizzle

    (@darsunrb)

    Also, I usually put
    before my text in most my cells to drop the text by a line.

    Is there a similar css code that will achieve the same as
    that I can add to the custom css?

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    Sure, that’s no problem ??
    You can simply use

    .tablepress-id-20 th,
    .tablepress-id-20 td {
      text-align: center;
    }

    to center every cell.

    If you just want to center all cells in a particular row, you can use

    .tablepress-id-20 .row-4 td {
      text-align: center;
    }

    To then also move things down in the cell, you could increase the top padding:

    .tablepress-id-20 td {
      padding-top: 20px;
    }

    Regards,
    Tobias

    Thread Starter dbizzle

    (@darsunrb)

    Hi Tobias

    I’ve left you a small donation to say thanks for the quick reply.

    I added the first piece of code you suggested and it worked like a charm and every cell is now centred.

    I still can’t get the text to move down in a cell though.

    If you take this page as an example: https://www.betstallion.com/home-wins/

    Taking the table header out of the equation, I want every cell apart from the final two columns (the images) to move down a space as if I added
    at the beginning of each cell – but obviously I need it in css form to add to the custom css.

    Am I doing something wrong?

    Thread Starter dbizzle

    (@darsunrb)

    My custom css currently looks like this, but still cant get the desired text to drop a line:

    .tablepress-id-20 th,
    .tablepress-id-20 td {
    text-align: center;
    }

    .tablepress-id-20 th,
    .tablepress-id-20 td {
    padding-top: 20px;
    }

    Thread Starter dbizzle

    (@darsunrb)

    the previous url I left is incorrect, it should read: https://www.betstallion.com/home-win/

    All the text is currently dropped a line just how I want it, but that’s because i’ve added < br > at the beginning of each cell. Would still prefer a css solution to save time, am in no hurry though! thanks.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    first: Thanks for the donation, I really appreciate it!

    Now, to make that larger spacing work:
    At first, please remove all of those <br> that you have added, so that those don’t interfere with our CSS tries.
    Then, try again with

    .tablepress-id-20 tbody td {
      padding-top: 20px !important;
    }
    .tablepress-id-20 tbody .column-8,
    .tablepress-id-20 tbody .column-9 {
      padding-top: 8px !important;
    }

    Regards,
    Tobias

    Thread Starter dbizzle

    (@darsunrb)

    Works perfectly!! THANK YOU! Will leave a review tomorrow!

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!
    And thanks for the review, I really appreciate it!

    Best wishes,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Center All cells in table’ is closed to new replies.