Anchor around table - NOT working in outlook

牧云@^-^@ 提交于 2019-12-09 06:35:21

问题


I'm developing a newsletter for Mailchimp with below HTML structure for one of the block -

<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center"> 
<tr> 
    <td valign="top" class="complete-block">
        <a href="#" target="_blank">
            <table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton display-inline" mc:hideable> 
                <tr> 
                    <td align="center"  valign="middle" class="templateButtonContent"> Amazon </td> 
                </tr> 
            </table>
        </a> 
        <a href="#" target="_blank">
            <table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton display-inline" mc:hideable> 
                <tr> 
                    <td  align="center" valign="middle" class="templateButtonContent"> Apple iBooks </td> 
                </tr> 
            </table>
        </a> 
        <a href="#" target="_blank">
            <table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton display-inline" mc:hideable> 
                <tr> 
                    <td align="center" valign="middle"  class="templateButtonContent"> Nook </td> 
                </tr> 
            </table>
        </a>
        <a href="#" target="_blank">
            <table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton display-inline" mc:hideable> 
                <tr> 
                    <td align="center"  valign="middle" class="templateButtonContent"> Google </td> 
                </tr> 
            </table>
        </a>
        <a href="#" target="_blank">
            <table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton display-inline" mc:hideable> 
                <tr> 
                    <td align="center" valign="middle"  class="templateButtonContent"> Kobo </td> 
                </tr> 
            </table>
        </a>
        <a href="#" target="_blank">
            <table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton display-inline" mc:hideable> 
                <tr> 
                    <td align="center" valign="middle"  class="templateButtonContent"> Sony </td> 
                </tr> 
            </table>
        </a> 
    </td>
</tr>

The problem is that when I tested the template on Outlook, I found that my buttons [Amazon, google, nook etc] don't have LINK.

What am I missing? Can't we wrap a table in anchor tag?


回答1:


HTML emails still lack the features that browsers makeup for on websites, it's like developer in HTML for IE 5. The anchor tag will not work around tables and sometimes will not even work around divs, however obviously webpages do not have these problems. This is due to the standards not really being recognised by mail clients as they are in browsers.

Try wrapping the content in the cells in just the anchor tag, around your button:

<table border="0" cellpadding="9" width="100%" align="center" cellspacing="0" class="templateButton displayinline" mc:hideable>
    <tr>
    <td align="center" valign="middle" class="templateButtonContent">
            <a href="#" target="_blank">Sony</a>
        </td>
    </tr>
</table>

I know it's not ideal, however it is a way around this problem.



来源:https://stackoverflow.com/questions/21368528/anchor-around-table-not-working-in-outlook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!