WordPress.org

Ready to get started?Download WordPress

Forums

Cannot Center Table (5 posts)

  1. selfmade64856
    Member
    Posted 4 years ago #

    Hello All,

    I can get the table to align left and to align right, however when it comes to align center it only aligns left.

    Does anyone know the cause of this? It happens in all editors such as tinymce and fckeditor.

    Here is the page that I attempted to center the table:
    http://sitesires.com/table-test/

    Thanks!

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    table.foobar {
    margin:0 auto;
    width:200px;
    }
  3. jeremyhelm
    Member
    Posted 4 years ago #

    esmi, I'm guessing you've answer the question here, but I'm not able to conjure the context I guess I need to benefit from it :/
    is this code example for css?

    how would I place it in relation to the following table?

    <table border="0" width=>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>

    thanks for your patience! I duhno;)

  4. selfmade64856
    Member
    Posted 4 years ago #

    esmi - sorry for taking so long to get back, your solution worked like a charm.

    jeremyhelm - In case you haven't figured it out yet which I'm sure you have, I simply added the css to the bottom of my stylesheet and saved it. All tables now have the ability to center for that theme.

    Thank you so much :)!

  5. c_wayne
    Member
    Posted 3 years ago #

    After a lot of trial and error and the lead from esmi above, I found that I could center a table with this as the beginning of the table code:

    <table style="width: 480px; margin: 1px auto;" align="center">

    (The key was the "margin: auto" setting. In my case I also wanted a 1px margin.)

    Hope this helps others.

Topic Closed

This topic has been closed to new replies.

About this Topic