Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the question.

    Yes, that’s usually possible with some CSS like this:

    .tablepress-id-123 {
      width: 300px;
    }

    That needs to be pasted into the “Custom CSS” textarea on the “Plugin Options” screen of TablePress.

    The browser will then set the individual column widths, depending on their contents. Therefore, this will only work, if the sum of the lengths of the contents in the cell is not bigger than the set width.

    Regards,
    Tobias

    I tried entering this code on my site but minus the -id-123 portion so that it would apply to all tables and it didn’t make a difference. I’ve tried resizing the individual columns too and it doesn’t seem to solve my problem. I’m curious if there is a conflict with this plugin and my theme or another plugin, but am not sure how to determine that.

    Any assistance would be greatly appreciated as I have 49 more tables to create. 🙂

    http://warriorsremembered.com/find/alabama-memorials/

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the link, that helps a lot! 🙂
    In your case, there’s indeed some CSS in the theme that is interfering with the code. Additionally, the “Horizontal Scrolling” checkbox on the “Edit” screen of the table is checked, which also influences this. I therefore recommend that you uncheck that.

    Additionally, instead of setting the width of the table, we’ll need to reduce the inner spacing in the cells (“padding”). So, please remove the CSS from above again and add this instead:

    #content .tablepress tbody td {
        padding: 6px;
    }
    #content .tablepress thead th {
        padding: 6px 20px 6px 6px;
    }

    Regards,
    Tobias

    Tobias,

    I added the above code in and made the other changes you suggested and the table is looking better. Is it possible to make the 3rd and last column wider? Or is this limited by my template?

    Thanks so much for your help!

    here is the site again for your reference:
    http://warriorsremembered.com/find/alabama-memorials/

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    good to hear that this helped already.

    Now, making the third and the last column wider will indeed not really work in this theme (or at least not without modifications in it).
    Right now, the maximum table width (that the table already has right now), is defined by the theme. So, increasing the width of the third and last columns would now require that other columns shrink. That’s however not really possible, as the content in those also requires a minimum width.

    So, the only real possibility here (except maybe for reducing the font size of the table, but that’s ugly) is to modify the theme to allow for a wider page content or to switch to a different theme.

    Regards,
    Tobias

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

The topic ‘CSS for max size of table?’ is closed to new replies.