html 电子邮件签名中的按钮不可点击

Buttons in html email signature not clickable

我正在尝试使用按钮为电子邮件签名下方的横幅创建一个漂亮的可点击界面。当我在上传前 运行 它有效,但在我上传后它停止运行。

    <button onclick="window.location.href = 'url';
       "style="background-color: #e1b53f;width: 136px;
        height: 75px;box-shadow:0px 2px 2px #d5ad4b;color: #000;
        margin:0px auto;padding: 0px;border-radius: 17px;
        font-family: 'garamond', palatino, serif;font-size: 17px;"><strong>View<br>Gulf 
        Coast<br>Homes</strong>
     </button>

我不确定这是代码中的错误,还是我的电子邮件提供商的 html 上传程序有问题。

您使用 javascript 代码进行重定向通常 javascript 在电子邮件模板中不起作用

尝试通过添加锚标记来更改您的代码,如下所示。

<a href="url">
      <button style="background-color: #e1b53f;width: 136px;
        height: 75px;box-shadow:0px 2px 2px #d5ad4b;color: #000;
        margin:0px auto;padding: 0px;border-radius: 17px;
        font-family: 'garamond', palatino, serif;font-size: 17px;">     
        <strong>
          View
          <br/>Gulf Coast
          <br/>Homes
        </strong>
      </button>
    </a>

如果您使用的电子邮件应用程序是 outlook(或 phone),标签按钮将不起作用(也许其他电子邮件应用程序也是如此)。我建议您将按钮替换为锚标记并在其上应用按钮外观,如下所示:

<a href="url"
   style="-webkit-appearance: button;
   -moz-appearance: button;
   appearance: button;   
   text-decoration: none; background-color: #e1b53f;width: 136px;
   height: 60px;box-shadow:0px 2px 2px #d5ad4b;color: #000;
   padding: 2px;border-radius: 17px;
   font-family: 'garamond', palatino, serif;font-size: 17px; text-align: center">
    <strong>
      View<br>Gulf Coast<br>Homes
    </strong>
</a>