【问题标题】:Magento 1.9 - style email templateMagento 1.9 - 风格的电子邮件模板
【发布时间】:2015-05-28 10:50:15
【问题描述】:

我正在尝试在电子邮件模板中应用我的自定义 CSS。 我已经做过这些事情了。

  1. 将内联 css 添加到我的 html
    <table align="center" style="width:600px; background:#FFF; border:1px solid #CCC; padding:0; margin-top:0; border-collapse:collapse;">
  2. 包含内联css文件并在admin->system->configuration->design中添加这些css的路径
    {{inlinecss file="email-inline.css"}} {{inlinecss file="email-non-inline.css"}}
    我检查了它们是否包括或不包括将正文背景颜色编辑为黑色

但还没有成功。 我正在编辑时事通讯订阅电子邮件模板。

通过将 {{var non_inline_styles}} 添加到我的 html 文件中,我成功添加了 style 标记。但无法将我的 css 写入样式标记.如何在这个标签中编写自己的 CSS。

谁能告诉我如何设置我的电子邮件模板的样式 我也试过这个
http://devdocs.magento.com/guides/m1x/ce19-ee114/RWD_responsive_emails.html#email-css

这是我的模板文件代码

    <!--@subject Newsletter subscription success @-->
    {{template config_path="design/email/header"}}
    {{var non_inline_styles}}
    {{inlinecss file="email-inline.css"}}
    {{inlinecss file="email-non-inline.css"}}
<div class="newsletter-confirmation">
<table align="center" style="width:600px; background:#FFF; border:1px solid #CCC; padding:0; margin-top:0; border-collapse:collapse;">
    <!--Header -->
    <tr>
        <td style="padding:18px; margin:0; height:40px\9;">

            <p style="float:right; margin:0; padding:0; width:200px;">
                <img src="{{skin url='images/hot_line.jpg'}}" style="text-align:right; vertical-align:bottom; float:right; clear:both; margin-top:21px;">
            </p>
        </td>
    </tr>
    <tr><td style="height:1px; border-bottom:1px solid #000; width:100%; margin:0; padding:0; line-height:0;">&nbsp;</td></tr>
    <!-- / Header -->
    <!--Mid -->
    <tr>
        <td>
            <table align="center" style="width:564px; background:#FFF; padding:18px; margin-top:0; border-collapse:collapse; margin-top:10px;">
                <tr>
                    <td>

                        <p style="color:#000; font:12px/20px Arial, Helvetica, sans-serif; padding:0; margin:0;">Greetings from ...!<br>

                            You have been successfully subscribed to the newsletter.</p>
                    </td>
                </tr>

                <tr><td height="18"></td></tr>


                <tr>
                    <td>
                        <table align="center" style="width:564px; margin:0; padding:0; border-collapse:collapse;">
                            <tr>
                                <td><a href="#" target="_blank" style="margin:0; padding:0 10px 0 0; border:none; outline:none;">
                                        <img src="{{skin url='images/free-shipping.jpg'}}" style="text-align:left; vertical-align:bottom; border:none; outline:none; margin:0; padding:0;"></a>
                                </td>
                                <td rowspan="2"><a href="#" target="_blank" style="margin:0; padding:0; border:none; outline:none;">
                                        <img src="{{skin url='images/return-exchange.jpg'}}" style="text-align:left; vertical-align:bottom; border:none; outline:none; margin:0; padding:0 0 0 10px;"></a>
                                </td>
                            </tr>

                        </table>
                    </td>
                </tr>
                <tr>
                    <td>
                        <p style="color:#000; font:12px/20px Arial, Helvetica, sans-serif; padding:0; margin:12px 0;">Thank you<br><strong>Team ...</strong></p>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <!--Mid -->
    <!--Footer -->
    <tr>
        <td style="width:582px; padding-left:18px; background:#efefef;" >
            <p style="color:#666666; font:11px/15px Arial, Helvetica, sans-serif; padding:0; margin:8px 0;">
                <a href="http://www.....com/" target="_blank" style="margin:0; padding:0; color:#666666; text-decoration:none;">....com</a> All Rights Reserved.
            </p>
        </td>
    </tr>
    <!-- / Footer -->
</table>
</div>
{{template config_path="design/email/footer"}}

【问题讨论】:

  • 你想做什么?你是如何设计你的电子邮件的? - 使用内联样式往往最适合电子邮件。看起来您的电子邮件已经有很多内联样式
  • 我正在尝试设置我的电子邮件模板的样式。所以我在我的 html 中添加了内联样式,但它们不起作用。所以我想知道如果内联样式不起作用,我该如何设置样式
  • 我只尝试了一种风格,即&lt;table align="center" style="width:600px; background:#FFF; border:1px solid #CCC; padding:0; margin-top:0; border-collapse:collapse;"&gt;,但它也没有反映出来
  • 内联 css 在 Magento 中运行良好...但是,当您在外部设置样式时,您会遇到 gmail 或 yahoo 的一些问题(我曾经遇到过这个问题)。
  • 惊喜!! .. 一票接近.. 还有什么比这更能解释的呢

标签: php css magento magento-1.9 email-templates


【解决方案1】:

在你的情况下,样式应该像下面这样写

<!--@styles
.button {
color: white!important;
width: 19%;
padding: 8px;
border-radius: 5px;
}
.approve {
background: rgba(18, 171, 18, 0.72);
margin-right:5px;
}
.disapprove {
background: rgba(232, 73, 73, 0.91);
}
.actions {
    display: inline-block;
    margin-top: 32px;
}
@-->

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-06-05
    • 1970-01-01
    • 2011-04-10
    • 1970-01-01
    • 1970-01-01
    • 2011-06-15
    • 2023-04-02
    相关资源
    最近更新 更多