How to change table width?

  • Author
    Posts
  • #772412

    I’m trying to make a table, but I can change neither the table width nor cell width. I’ve tried every combination of width=”” that I can think of (in the table and td tags) and have tried to find solutions elsewhere. But regardless of what I try, the table always fits to the page. I’m relatively new to WP and don’t know much html or css – thanks in advance for all/any help!

    The blog I need help with is womensfilmandtelevisionhistory.wordpress.com.

    #772580

    timethief
    Member

    Your blog is private and we have no table code here that we can see. We don’t even know which theme you are using. Please post the table code you are using here between code tags. Please also tell us which theme you are using.

    #772627

    Thank you timethief. I am using the 2011 theme. I copied and pasted a table for Word. This is the html for the table from my page:

    <table border=”1″ cellspacing=”0″ cellpadding=”0″>
    <tbody>
    <tr>
    <td colspan=”7″ valign=”top” width=”616″>
    <p align=”center”>January 2012</p>
    </td>
    </tr>
    <tr>
    <td valign=”top” width=”88″>
    <p align=”center”>Mon</p>
    </td>
    <td valign=”top” width=”88″>
    <p align=”center”>Tues</p>
    </td>
    <td valign=”top” width=”88″>
    <p align=”center”>Wed</p>
    </td>
    <td valign=”top” width=”88″>
    <p align=”center”>Thurs</p>
    </td>
    <td valign=”top” width=”88″>
    <p align=”center”>Fri</p>
    </td>
    <td valign=”top” width=”88″>
    <p align=”center”>Sat</p>
    </td>
    <td valign=”top” width=”88″>
    <p align=”center”>Sun</p>
    </td>
    </tr>
    <tr>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″>1</td>
    </tr>
    <tr>
    <td valign=”top” width=”88″>2</td>
    <td valign=”top” width=”88″>3</td>
    <td valign=”top” width=”88″>4</td>
    <td valign=”top” width=”88″>5</td>
    <td valign=”top” width=”88″>6</td>
    <td valign=”top” width=”88″>7</td>
    <td valign=”top” width=”88″>8</td>
    </tr>
    <tr>
    <td valign=”top” width=”88″>9</td>
    <td valign=”top” width=”88″>10</td>
    <td valign=”top” width=”88″>11</td>
    <td valign=”top” width=”88″>12</td>
    <td valign=”top” width=”88″>13</td>
    <td valign=”top” width=”88″>14</td>
    <td valign=”top” width=”88″>15</td>
    </tr>
    <tr>
    <td valign=”top” width=”88″>16</td>
    <td valign=”top” width=”88″>17</td>
    <td valign=”top” width=”88″>18</td>
    <td valign=”top” width=”88″>19</td>
    <td valign=”top” width=”88″>20</td>
    <td valign=”top” width=”88″>21</td>
    <td valign=”top” width=”88″>22</td>
    </tr>
    <tr>
    <td valign=”top” width=”88″>23</td>
    <td valign=”top” width=”88″>24</td>
    <td valign=”top” width=”88″>25</td>
    <td valign=”top” width=”88″>26</td>
    <td valign=”top” width=”88″>27</td>
    <td valign=”top” width=”88″>28</td>
    <td valign=”top” width=”88″>29</td>
    </tr>
    <tr>
    <td valign=”top” width=”88″>30</td>
    <td valign=”top” width=”88″>31</td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    <td valign=”top” width=”88″> </td>
    </tr>
    </tbody>
    </table>

    Thanks again.

    #772655

    Most of what you’re trying to use is deprecated and won’t work. You need inline CSS instead, that is, properties and values in the style attribute.

    Turn this:
    <table border="1" cellspacing="0" cellpadding="0">
    to this:
    <table style="width:auto;border:1px solid #ddd;">

    Turn this:
    <td colspan="7" valign="top" width="616">
    to this:
    <td colspan="7" style="vertical-align:top;border:1px solid #ddd;padding:10px;">

    Turn these:
    <td valign="top" width="88">NUMBER</td>
    to:
    <td style="vertical-align:top;width:88px;border:1px solid #ddd;padding:10px;">NUMBER</td>

    Turn these:

    <td valign="top" width="88">
    <p align="center">TEXT</p>
    </td>

    to:

    <td style="vertical-align:top;width:88px;border:1px solid #ddd;text-align:center;padding:10px;">
    TEXT
    </td>

    (padding:10px is just an example – change the number to adjust it.)

The topic ‘How to change table width?’ is closed to new replies.