WordPress.org

Ready to get started?Download WordPress

Forums

TablePress
[resolved] Table Width Set (4 posts)

  1. gregmccomish
    Member
    Posted 1 year ago #

    Hello,

    I am trying to force a table to a certain width. The table is on this page:
    http://aplus-web-design.com/test-page-2

    Note, due to client needs, you will first get to the landing page of the website at: http://aplus-web-design.com/
    To get to my test page, click either big picture, then type this address:
    http://aplus-web-design.com/test-page-2

    The table has to be a width of 816 pixels and a height of 510 pixel.

    I used this Custom CSS:

    .tablepress-id-1 {
    	width: 816px;
    }

    But the width of the table is not changing. What am I overlooking? Note that I understand CSS but cannot write it off the top of my head so examples would be greatly appreciated!
    Greg

    http://wordpress.org/extend/plugins/tablepress/

  2. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Greg,

    thanks for your question.

    The reason for this is that in tables, the content determines the minimum width. In your case, you have four columns with images in them. The images are all 189px wide each, according to their width attribute in the HTML. Addtionally, each of the cells has a 8px padding on its inside (which shows as the white space around the image). Thus, each cell is 205px wide, and in sum, the table is therefore 4*205px = 820px wide.
    You'll just have to make the images one pixel smaller, or reduce the padding of the cells, that's it.
    There's no need to edit the width of the table, as that will extend to 100% of the width of the content area (which is 816px) by default (except for your case where the content requires are larger minimum width of 820px).

    Regards,
    Tobias

  3. gregmccomish
    Member
    Posted 1 year ago #

    Hi Tobias,

    Wow--speedy reply--wish all forums had people like you answering questions!

    Anyway, I am still confused.
    First where do I remove the 8px padding in the table cells?

    I want to force the table size to 816 pixels--right now it appears to be about 807 pixels wide. My client needs it to be 816 pixels wide. So if I removed the 8px padding, I think it would get smaller, not bigger.

    Thanks again in advance!
    Greg

  4. TobiasBg
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    sure, no problem for the reply :-)

    Removing that padding is possible with some "Custom CSS":

    .tablepress-id-1 td {
      padding: 0px;
    }

    This will lead to the table being 4*189px = 756px wide. Right now, it is 820px wide (I checked that with the Google Chrome Developer Tools), but as the padding is of course on the very left and the very right, it might appear smaller.

    Regards,
    Tobias

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic