• Resolved mcxg46

    (@mcxg46)


    Hi,

    Sorry for another column widths forum post. But I’ve read your FAQ and documentation, but am still having trouble changing column widths.

    I’ve tried variants of the below, both in the plugin’s css area and that of my theme, with and without !important. But when I look at the elements in a browser’s developer tools, something seems to be adding in a smaller width.

    (Basically, since the table is going to need horizontal scrolling anyway, I want to set the columns to fit the text.)

    Here’s hoping you can help,

    Thanks,

    John

    .tablepress th,
    .tablepress td {
    word-break: normal;
    }

    .tablepress column-3,
    {
    width: 300px;
    }

    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.

    The problem in your code (syntactically) is that ,. There must not be any commas right before the {. You would have to use

    .tablepress column-3 {
      width: 300px;
    }

    However, you will find that this won’t work here either, because the table is too wide already. The browser then tries to keep it narrow and ignores your wish for the width.
    However, you can force it to have a wider width, by disallowing automatic line breaks. For that, please add this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    .tablepress-id-1 {
      white-space: nowrap;
    }

    Regards,
    Tobias

    Thread Starter mcxg46

    (@mcxg46)

    Hi Tobias,

    Thanks for getting back to me so quickly. The extra comma was just a typo on my part when writing the post. But the nowrap snippet did the trick – thanks!

    One last question – I’ve given them all a width of 100%, which seems to have resulted in them all automatically expanding to fit the field text. Which is fantastic, but is this likely to cause any unforseen issues?

    John

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi John,

    I wouldn’t set the columns’ width to 100%. This doesn’t really make sense (as they are now “competing”, and after removing that, you’ll likely not see a difference (due to the nowrap CSS).

    Regards,
    Tobias

    Thread Starter mcxg46

    (@mcxg46)

    You’re quite right – the columns expand to fit the text just fine without setting the width 100%.

    Thanks for your all your help – much appreciated.

    John

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problems changing column width’ is closed to new replies.