• Resolved ethene86

    (@ethene86)


    Hi, when i tried adding the code to adjust table width to 50%, it will not work. Only when i add !important to the width code then it will work. However, when i do that, the table will suddenly align center. I tried many codes but the table will still be stubbornly aligned center with a 50% width. Hope its not some kind bug. Able to assist?

    Demo: https://kingsmed.com.sg/test-2/

    • This topic was modified 2 years, 11 months ago by ethene86.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    This is indeed the expected behavior here. When the table width is reduced, the table is automatically centered. To change that, please try this extended CSS code:

    .tablepress-id-34 {
        width: 50% !important;
        margin: 0 0 1em 0;
    }

    (The !important flag that you mention is only needed because your theme is also setting the width of tables to 100%.)

    Regards,
    Tobias

    Thread Starter ethene86

    (@ethene86)

    Hi you are amazing! May i seek your advice as to why the rest of my site also using tablepress doesnt have this auto-align to center effect when i reduce the table width? They still stick to the left.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    where exactly do you mean?

    regt

    Regards,
    Tobias

    Thread Starter ethene86

    (@ethene86)

    Hi i mean i am doing the same thing over at my other websites that also use Tablepress. The table did not auto-align centre even if i set the width to 50%. Do you know why only certain website has this issue?

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    This centering is the default behavior of TablePress and it’s on purpose (so it’s not actually an “issue” 🙂 ).

    It’s possible that there’s already other CSS code on those other sites (maybe from previously added “Custom CSS” or maybe the theme) that is changing that to left-aligned.

    If you post a link, I can try to find out why the behavior is different.

    Regards,
    Tobias

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Table unable to align left’ is closed to new replies.