• Resolved adamovic

    (@adamovic)


    Hi,

    I’ve been messing around with centering tables on a page and can’t seem to find a solution.
    So far I have tried:

    .tablepress-id-28 {
    	width: auto;
    	margin: 0 auto 1em;
    }
    .entry .tablepress-id-28 {
    	width: auto;
    	margin: 0 auto 1em;
    }

    and unchecking datatables.
    I’ve been playing with table 28 but I have the same issue with basically all tables, which have fewer columns.

    Any ideas?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    Please try

    .dataTables_wrapper .tablepress-id-28 {
    	width: auto;
    	margin: 0 auto 1em !important;
    }

    here.

    Regards,
    Tobias

    Thread Starter adamovic

    (@adamovic)

    Cool, this works, except for the header. How can I include that?

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    ah, you are using the DataTables Horizontal Scrolling feature. That makes things more difficult here. As a replacement I suggest to use the scroll mode of the TablePress Extension from https://tablepress.org/extensions/responsive-tables/.
    That will make this easier.
    So, please uncheck the “Use DataTables” checkbox on the table’s “Edit” screen and instead use that scroll mode.

    Regards,
    Tobias

    Thread Starter adamovic

    (@adamovic)

    Great, thanks!

    However, I found it better to set the width of a table exactly the way it is instead of auto or it doesn’t scale so well on mobile.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    yes, that might work better as the browser otherwise does that calculation.

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Tables not centered’ is closed to new replies.