嵌套在<table> </table> html电子邮件中

时间:2017-01-11 16:10:55

标签: html nested html-email css-tables

我在这里完全失败了。我想在一个html电子邮件的居中表中嵌套多个表,并且firebug和W3C验证器都告诉我我有更多的打开表标签而不是关闭表标签。在firebug中的测试显示包含表与嵌套表之前的情况,而不是围绕它们。

如果我将包含<table>更改为<div>,则所有问题都会消失。不知道出了什么问题。

以下是有问题的html电子邮件:http://coastmusic.com/optiweb/

2 个答案:

答案 0 :(得分:3)

您目前在容器表中有这个:

<table width="600" cellpadding="0" cellspacing="0" align="center">
  <table width="600" cellpadding="0" cellspacing="0" align="center">

您需要在容器表

之后添加trtd标记
<table width="600" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td>
      <table width="600" cellpadding="0" cellspacing="0" align="center">

同时添加适当的结束标记。

答案 1 :(得分:0)

我清理了你的代码..正如Gwesolo所说,你需要一些tr和td围绕你的桌子。

<!DOCTYPE html>
<html>
<head>
<title>Elixir OPTIWEB Coating</title>
</head>
<body bgcolor="#E9EAEA">
<table width="100%" cellpadding="0" cellspacing="0" align="center">
<tr>
    <td width="100%" align="center">
    <table width="600" cellpadding="0" cellspacing="0" align="center">
    <tr>
        <td><img src="assets/header.jpg" />
        </td>
    </tr>
    <tr>
        <td align="center"><img src="assets/packaging-eyecandy.jpg" />
        </td>

    </tr>
    <tr>
        <td style="background-color: #282727; color: #FFF;">
            <h1 style="font-size: 18px; font-family: sans-serif; margin-bottom: 0; padding: 5px 5px 0 5px;">INTRODUCING OPTIWEB&trade; COATING</h1>

            <p style="font-size: 12px; font-family: sans-serif; padding: 0 5px 5px 5px; margin-top: 5px;">Elixir&reg; OPTIWEB Coated Electric Guitar Strings feature a crisp tone that sounds indistinguishable from uncoated strings and a more natural familiar feel than both NANOWEB&reg; and POLYWEB&reg; Coated Strings without sacrificing the extended tone life that players have come to expect from Elixir Strings.</p>

        </td>
    </tr>
</table>
<!--2 column-->
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #FFF; padding-bottom: 20px;" align="center">
    <tr>
        <td><img style="margin-top: 10px;" src="assets/string-closeup.jpg" />
        </td>

        <td>
            <h2 style="font-size: 14px; font-family: sans-serif; margin-top: 5px; margin-bottom: 0; padding-left: 10px; padding-right: 10px;">Unlike other string brands, Elixir Strings coats the whole string</h2>

            <p style="font-size: 12px; font-family: sans-serif; margin-top: 5px; margin-bottom: 5px; padding-left: 10px; padding-right: 10px;">The NANOWEB, POLYWEB and OPTIWEB Coatings not only protect the outer string surface, but also the gaps between the windings where tone-deadening debris typically builds up in other brands' coated and uncoated guitar strings. Anti-Rust Plating on plain steel strings ensures longer tone life for the entire set.</p>

            <a target="_blank" style="display: block;" href="https://www.youtube.com/watch?v=OC6DegDso2Y"><img src="assets/yt-link.jpg" />
            </a>

        </td>
    </tr>
</table>
<!--1 column-->
<table width="600" cellpadding="0" cellspacing="0" style="background-color: #FFF;" align="center">
    <tr>
        <td align="center">
            <hr style="margin: 5px;" />
            <h2 style="font-size: 18px; font-family: sans-serif; margin-bottom: 0; margin-top: 5px; padding-left: 10px; padding-right: 10px;">The range to meet the playing style of every electric guitarist</h2>

            <p style="font-size: 12px; font-family: sans-serif; margin-top: 5px; padding-left: 10px; padding-right: 10px;">With the introduction of OPTIWEB Coating, Elixir Strings satisfies player demands.</p>
        </td>
    </tr>
    <tr>
        <td align="center">
            <img src="assets/chart.jpg" />
        </td>
    </tr>
    <tr>
        <td align="center">
            <img src="assets/ab-chart.jpg" />
        </td>
    </tr>
    <tr>
        <td>
            <h2 style="font-size: 14px; font-family: sans-serif; padding-left: 10px; padding-right: 10px; margin-bottom: 5px;">Musicians can't hear the difference between OPTIWEB Coated and uncoated strings</h2>

            <p style="font-size: 12px; font-family: sans-serif; padding-left: 10px; padding-right: 10px;  margin-top: 0;">Uncoated and coated players alike confirm that OPTIWEB Coated Electric Strings have the same tone as uncoated strings.* Hear for yourself with our A/B sound test that compares OPTIWEB Coated Electric Strings with uncoated strings!

                <span>*Elixir Strings electric tone and feel field trials</span>
            </p>
        </td>
    </tr>
    <tr>
        <td align="center">
            <a target="_blank" style="display: block;" href="http://www.elixirstrings.com/experience/"><img style="margin: 10px 0;" src="assets/hear-the-difference.jpg" />
            </a>
        </td>
    </tr>
    <tr>
        <td>
            <h2 style="font-size: 14px; font-family: sans-serif; padding-left: 10px; padding-right: 10px; margin-bottom: 5px;">GEAR UP SWEEPSTAKES!</h2>

            <p style="font-size: 12px; font-family: sans-serif; padding-left: 10px; padding-right: 10px; margin-top: 0;">All OPTIWEB Coated Electric String Sets will include a game piece for a chance to win impressive weekly, monthly and grand prizes in the consumer sweepstakes. Look for specially marked packages!
                <span>*Sweepstakes is not open to residents of Quebec.</span>
            </p>
        </td>
    </tr>
    <tr>
        <td align="center">
            <img style="margin: 10px 0;" src="assets/learn-more.jpg" />
        </td>
    </tr>
    <tr style="background-color: #282727; height: 30px;">
        <td align="center">
            <img style="margin-top: 5px;" src="assets/coast-logo.jpg" />
        </td>
    </tr>
    <tr style="background-color: #282727; color: #FFF;">
        <td>
            <p style="font-size: 12px; font-family: sans-serif; text-align: center; margin-top: 5px; margin-bottom: 10px;">Copyright &copy; 2017 Coast Music, All rights reserved.
                <br /> Our mailing address is: Coast Music 21000 Trans-Canadienne Baie-d'urfe, Qc H9X 4B7 Canada</p>

        </td>
    </tr>
</table>
</td>
</tr>
</table>
</body>
</html>