HTML5信息图形电子邮件模板源代码问题


HTML5 Infographic Email Template Source Code Issue

我一直在网上搜索,以获得一个使用PHP发送电子邮件的信息图电子邮件模板。我们是否可以在电子邮件正文中移动HTML内容,或者在单击事件时在电子邮件正文内弹出。基本上显示和隐藏HTML内容就可以了。

任何实现了这一点的网站或URL都会对我的发展非常有帮助。

请参阅下面的示例代码:(但该样式在Gmail中被删除:()

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
    <head>
        <!-- This code is part of a tutorial from Email on Acid: https://www.emailonacid.com/blog/article/email-development/build-an-interactive-carousel-for-email -->
        <title>Interactive Carousel</title>
        <!--[if !mso]><!-->
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <!--<![endif]-->
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <style type="text/css">
            @media only screen and (-webkit-min-device-pixel-ratio: 1), (min--moz-device-pixel-ratio: 1), (max-width: 480px), (max-device-width: 480px) {
                .slide1-content,
                .slide2-content,
                .slide3-content {
                     display: block;position: absolute;top: 0px;left: 0px;width: 600px;height: 520px;background-color: #FFFFFF;
                }
            }
            @media only screen and (-webkit-min-device-pixel-ratio: 1), (min--moz-device-pixel-ratio: 1) {
                .slide1-content {left: 0px;}
                .slide1:hover { background-color: #37B330;}
                #slide-1:checked ~ .slide1 {background-color: #37B330 !important;}
                #slide-1:checked + span + table .swoosh { left: 0px !important; }
                .slide2 { top: 66px; left: 321px; }
                .slide2-content { left: 600px; }
                .slide2:hover { background-color: #37B330;}
                #slide-2:checked ~ .slide2 {background-color: #37B330 !important;}
                #slide-2:checked + span + table .swoosh { left: -600px !important; }
                .slide3 { top: 122px; left: 321px; }
                .slide3-content { left: 1200px; }
                .slide3:hover { background-color: #37B330;}
                #slide-3:checked ~ .slide3 {background-color: #37B330 !important;}
                #slide-3:checked + span + table .swoosh { left: -1200px !important; }
            }
        </style>
    </head>
    <body style="background-color:#6c6c6c;margin: 0px;padding: 0px;" bgcolor="#6c6c6c">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#6c6c6c" style="width: 100% !important; table-layout:fixed;mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
            <tr>
                <td valign="top" align="center" style="border-collapse: collapse;">
                    <div class="wrapper" style="min-width: 640px;">
                        <table id="CarouselWrapper" width="600" border="0" cellpadding="0" cellspacing="0" bgcolor="#ffffff" class="shrink" style="width:600px; margin:0 auto;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 415px !important;height: 895px !important;position: relative;display: block;overflow: hidden;">
                            <tr>
                                <td style="border-collapse: collapse;">
                                    <table class="CarouselMain" width="600" bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" style="border-collapse:collapse;mso-table-lspace: 0pt;mso-table-rspace: 0pt;width: 600px !important;height: 1400px !important;">
                                        <tr>
                                            <td valign="top" style="border-collapse: collapse;">
                                                <table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                    <tr>
                                                        <td style="line-height:1px; font-size:0px;border-collapse: collapse;">
                                                                <!--[if mso]><p style="display: none;"><![endif]-->
                                                            <form action ="foo">
                                                                <input class="yahoo" type="radio" name="action" checked="checked" id="slide-1" style="display: none!important; max-height: 0; visibility: hidden;" />
                                                                <span style></span>
                                                                <!--[if mso]></p><![endif]-->
                                                                <table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                                    <tr>
                                                                        <td style="line-height:1px; font-size:0px;border-collapse: collapse;">
                                                                                <!--[if mso]><p style="display: none;"><![endif]-->
                                                                            <input class="yahoo" type="radio" name="action" id="slide-2" style="display: none!important; max-height: 0; visibility: hidden;" />
                                                                            <span style></span>
                                                                            <!--[if mso]></p><![endif]-->
                                                                            <table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                                                <tr>
                                                                                    <td style="line-height:1px; font-size:0px;border-collapse: collapse;">
                                                                                            <!--[if mso]><p style="display: none;"><![endif]-->
                                                                                        <input class="yahoo" type="radio" name="action" id="slide-3" style="display: none!important; max-height: 0; visibility: hidden;" />
                                                                                        <span style></span>
                                                                                        </form>
                                                                                        <!--[if mso]></p><![endif]-->
                                                                                        <table border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                                                            <tr>
                                                                                                <td style="border-collapse: collapse;">
                                                                                                    <table class="swoosh" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;position: relative;transition: all 0.3s ease-out;-webkit-transition: all 0.3s ease-out;-moz-transition: all 0.3s ease-out;-ms-transition: all 0.3s ease-out;-o-transition: all 0.3s ease-out;">
                                                                                                        <tr>
                                                                                                            <td class="slide1-content" style="border-collapse: collapse;display: block;position: absolute;top: 0px;left: 0px;width: 600px;height: 520px;background-color: #FFFFFF">
                                                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                                                                                    <tr>
                                                                                                                        <td valign="top" height="320" style="border-collapse: collapse;">
                                                                                                                            <img style="border: none !important;" src="https://www.emailonacid.com/images/emails/carousel/image3.jpg" width="320" />
                                                                                                                        </td>
                                                                                                                    </tr>
                                                                                                                </table>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td height="10" style="line-height:1px;font-size:1px;display:block;border-collapse: collapse;">&nbsp;</td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td class="slide2-content" style="border-collapse: collapse;">
                                                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                                                                                    <tr>
                                                                                                                        <td valign="top" height="320" style="border-collapse: collapse;">
                                                                                                                            <img style="border: none !important;" src="https://www.emailonacid.com/images/emails/carousel/image2.jpg" width="320" />
                                                                                                                        </td>
                                                                                                                    </tr>
                                                                                                                </table>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td height="10" style="line-height:1px;font-size:1px;display:block;border-collapse: collapse;">&nbsp;</td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td class="slide3-content" style="border-collapse: collapse;">
                                                                                                                <table width="100%" border="0" cellpadding="0" cellspacing="0" style="mso-table-lspace: 0pt;mso-table-rspace: 0pt;">
                                                                                                                    <tr>
                                                                                                                        <td valign="top" height="320" style="border-collapse: collapse;">
                                                                                                                            <img style="border: none !important;" src="https://www.emailonacid.com/images/emails/carousel/image4.jpg" width="320" />
                                                                                                                        </td>
                                                                                                                    </tr>
                                                                                                                </table>
                                                                                                            </td>
                                                                                                        </tr>
                                                                                                        <tr>
                                                                                                            <td height="10" style="line-height:1px;font-size:1px;display:block;border-collapse: collapse;">&nbsp;</td>
                                                                                                        </tr>
                                                                                                    </table>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                        <label class="button slide3" for="slide-3" style="display: none; max-height: 0; visibility: hidden; font-size:1px; line-height:1px;visibility: visible !important;max-height: 46px !important;width: 86px !important;padding:7px 0px 6px 0px;display: block !important;position: absolute !important;text-align: center;z-index: 7;background-color: #262626;box-sizing: content-box;color: #ffffff !important;font-family: Arial, Helvetica, sans-serif;font-size: 13px !important;line-height:16px !important;font-weight:bold;cursor:pointer;-webkit-transition: 0.1s ease-in;-moz-transition: 0.1s ease-in;-ms-transition: 0.1s ease-in;-o-transition: 0.1s ease-in;">
                                                                                            <span class="hide" style="color:#ffffff;">Three</span>
                                                                                        </label>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                            <label class="button slide2" for="slide-2" style="display: none; max-height: 0; visibility: hidden; font-size:1px; line-height:1px;visibility: visible !important;max-height: 46px !important;width: 86px !important;padding:7px 0px 6px 0px;display: block !important;position: absolute !important;text-align: center;z-index: 7;background-color: #262626;box-sizing: content-box;color: #ffffff !important;font-family: Arial, Helvetica, sans-serif;font-size: 13px !important;line-height:16px !important;font-weight:bold;cursor:pointer;-webkit-transition: 0.1s ease-in;-moz-transition: 0.1s ease-in;-ms-transition: 0.1s ease-in;-o-transition: 0.1s ease-in;">
                                                                                <span class="hide" style="color:#ffffff;">Two</span>
                                                                            </label>
                                                                        </td>
                                                                    </tr>
                                                                </table>
                                                                <label class="button slide1" for="slide-1" style="display: none; max-height: 0; visibility: hidden; font-size:1px; line-height:1px;visibility: visible !important;max-height: 46px !important;width: 86px !important;padding:7px 0px 6px 0px;display: block !important;position: absolute !important;text-align: center;z-index: 7;background-color: #262626;box-sizing: content-box;color: #ffffff !important;font-family: Arial, Helvetica, sans-serif;font-size: 13px !important;line-height:16px !important;font-weight:bold;cursor:pointer;-webkit-transition: 0.1s ease-in;-moz-transition: 0.1s ease-in;-ms-transition: 0.1s ease-in;-o-transition: 0.1s ease-in;top: 10px; left: 321px;">
                                                                    <span class="hide" style="color:#ffffff;">One</span>
                                                                </label>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </table>
    </body>
</html>

注:是否可以在电子邮件正文中添加动态移动内容,即显示和隐藏div元素。

由于安全问题,无法按邮件发送脚本。此外,许多主要的邮件客户端,就像你在Gmail中注意到的那样,不支持大多数最简单的Html和Css。

Css动画在一些客户端中有效,在其他客户端中有效gif,但脚本在任何客户端中都不起作用。也许您可以使用此资源设计一个解决方案。Css动画设计复杂,构建起来很烦人,但如果客户端支持,可以隐藏元素或四处移动。

你也可以有启动动画的按钮,链接到一个网页,动画将在那里。但据我所知,这给了我一个可怕的用处。

如果你的大多数观众都使用Outlook,那么根本不值得用动画来创建一些东西,因为Outlook不支持这些功能。

希望这有帮助!