• Resolved skymningslage

    (@skymningslage)


    Ok so here is the problem:

    I have a simple wordpress site, on that site I have a “homepage” with pictures linking to posts with more pictures and text (770px wide). The problem is that the homepage has a table (1100px wide) in it with the pictures and needs to be centered and somehow it won’t center.

    I cannot change the width of the entire site to 1100px because then the post look like shit but when I do that the “homepage” and the table center as it should.
    So I want either to simply center the table on the first page or perhaps just make the one first page wider than the rest of the theme so the table will center correctly.

    I have tried some solutions as you can see in my stylesheet but I have run out of ideas.

    Here is the site:
    https://bit.ly/W9Sh34

    Any ideas?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You won’t be able to center that. Your table is within the wrapper div, which is already centred. So any additional width is going to span wider, like you’re seeing.

    If you’re going to use tables, you should be using <tr>s for new rows to make the table fit. If you’re using <div>s, you should be using CSS to make the items fit.

    Thread Starter skymningslage

    (@skymningslage)

    In my browsers at home (Safari, Firefox, IE) the table fits but it is not centered.
    Even if I change the wrapper to 1100px the table does not center. However if I change the “post” width to 1100 the table centers but then the posts are off instead.

    I don’t understand what you mean by using <tr> and <div>, I am using <tr> in the table already.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You’ve got too many items within your <tr>, so you need to use more <tr>s and spread out the items between them.

    Even if I change the wrapper to 1100px the table does not center

    The table won’t center as long as it’s within the wrapper.

    Thread Starter skymningslage

    (@skymningslage)

    Ok but the thing is that I want three items per row in the table.

    Apparently the table does center when I change the wrapper to 1100px but then the rest of the site is too wide.

    The wrapper is located in the header.php and my table is in one page using the page.php template, I don’t see how I possibly could move the template outside the “wrapper” code.

    Perhaps a custom page template is a way around this problem?

    Yes, or you could just change the width on that page by using this:

    body.home #wrapper {
        margin: 0 auto;
        width: 1200px;
    }

    That applies that width only to the home page.

    Thread Starter skymningslage

    (@skymningslage)

    You Sir or Madam are a lifesaver, that worked perfectly!

    Thank you very much!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Theme: Capricorn] Table won't center’ is closed to new replies.