user2991837
user2991837

Reputation: 798

100% width table in email with single fixed width cell

I'm building a very simple HTML email. There is one table with one row and one cell. I want the table to be 100% wide (to set a background color that will fill the window) and the cell to be centered with a width of 600px. Trouble is it doesn't work. Is this possible? Thanks for any help I've spent an hour searching around the internet and haven't got very far.

<body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%" bgcolor="#50917b"  align="center" >
        <tr>
            <td valign="top" max-width="600" bgcolor="#999999" >
            content test
            </td>
        </tr>
    </table>
</body>

Upvotes: 0

Views: 4106

Answers (2)

Tinashe Hodza
Tinashe Hodza

Reputation: 1

Try this.. outer table is 100% and inner nest table is 600px and aligned to the center. so this should work fine for you. : )

<body>
    <table class="wrapper" width="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
           <td bgcolor="#50917b" align="center">
            <table class="main" cellpadding="0" width="600" cellspacing="0" border="0">
              <tr>
                <td valign="top" bgcolor="#999999">
                  content test
               </td>
              </tr>
           </table>
          </td>
        </tr>
    </table>
</body>

Upvotes: 0

paulalexandru
paulalexandru

Reputation: 9530

If you want to achieve this try this:

<body>
    <table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%" bgcolor="#50917b"  align="center" >
        <tr>
            <td></td>
            <td valign="top" style="width: 600px; background: #999999;">               
                content test  
            </td>
            <td></td>
        </tr>
    </table>
</body>

Upvotes: 1

Related Questions