首页 > 解决方案 > HTML 电子邮件的图像左对齐问题

问题描述

编码和学习如何创建 HTML 电子邮件的新手。我随机选择了一封电子邮件并尝试复制它。

我正在尝试将 Google 图片与 Apple Play 商店图片对齐,并将社交媒体图标全部放在左侧。

我搜索过 W3、Google 和 Stack Overflow。我试图添加填充。

谢谢您的帮助。

                         <tr>
                            <td>
                                <img src="/img/applestorelogo.png" width="auto" height="24" style=" display: inline-block;" alt="applestorelogo"/>
                            </td>
                            <td>
                                <img src="/img/googlestore.png" width="auto" height="24" alt="googlestore"/>
                            </td>
                            <td><img src="/img/fb.png" width="auto" height="24"  alt="facebook"/>
                            </td>
                            <td><img src="/img/IG.png" width="auto" height="24" alt="instagram"/>
                            </td>
                            <td><img src="/img/twitter.png" width="auto" height="24" alt="twitter"/>
                            </td>
                        </tr>

下面是图片

标签: htmlcsshtml-email

解决方案


在我看来,您应该只使用三个<td>.

以下是您的方案的一个想法。您可能需要根据您的布局更改宽度:

<table border="1" style="width:50%">
<tr>
    <td style="text-align: center; width: 5%;">
        <img src="/img/applestorelogo.png" width="auto" height="24" alt="applestorelogo"/>
    </td>
    <td style="text-align: center;width: 5%;">
        <img src="/img/googlestore.png" width="auto" height="24" alt="googlestore"/>
    </td>
    <td style="text-align: right;">
        <img src="/img/fb.png" width="auto" height="24"  alt="facebook"/>  
        <img src="/img/IG.png" width="auto" height="24" alt="instagram"/>  
        <img src="/img/twitter.png" width="auto" height="24" alt="twitter"/>
    </td>
</tr>
</table>

推荐阅读