最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Linear gradient is not working in Outlook - Stack Overflow

programmeradmin1浏览0评论

I know this is a very basic question but I have tried many StackOverflow solutions but nothing worked for me.

This is the HTML content which I am using.

<html>
<style>
  div:after {
    content: "\A";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.5)), color-stop(100%, rgba(216, 38, 38, 0.7)));
    /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* Opera 11.10+ */
    background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* IE10+ */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* W3C */
  }
</style>
<div style="background:rgba(0,0,0,0.5);background:-moz-linear-gradient(top,rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%);background:-o-linear-gradient(top,rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%);background:-ms-linear-gradient(top,rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%);background: rgba(0,0,0,0.5);background: -moz-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.5)), color-stop(100%,rgba(0,0,0,0.7))); /* Chrome,Safari4+ *//* background: -webkit-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); */ /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); /* IE10+ */background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%,rgba(216, 30, 30, 0.7) 100%);  /* W3C */">
  <p>This is heading</p>
</div>

</html>

I know this is a very basic question but I have tried many StackOverflow solutions but nothing worked for me.

This is the HTML content which I am using.

<html>
<style>
  div:after {
    content: "\A";
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.5);
    background: -moz-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(0, 0, 0, 0.5)), color-stop(100%, rgba(216, 38, 38, 0.7)));
    /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* Opera 11.10+ */
    background: -ms-linear-gradient(top, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* IE10+ */
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(216, 38, 38, 0.7) 100%);
    /* W3C */
  }
</style>
<div style="background:rgba(0,0,0,0.5);background:-moz-linear-gradient(top,rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%);background:-o-linear-gradient(top,rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%);background:-ms-linear-gradient(top,rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%);background: rgba(0,0,0,0.5);background: -moz-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); /* FF3.6+ */background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(0,0,0,0.5)), color-stop(100%,rgba(0,0,0,0.7))); /* Chrome,Safari4+ *//* background: -webkit-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); */ /* Chrome10+,Safari5.1+ */background: -o-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); /* Opera 11.10+ */background: -ms-linear-gradient(top,  rgba(0,0,0,0.5) 0%,rgba(0,0,0,0.7) 100%); /* IE10+ */background: linear-gradient(to bottom, rgba(0,0,0,0.5) 0%,rgba(216, 30, 30, 0.7) 100%);  /* W3C */">
  <p>This is heading</p>
</div>

</html>

It is working on Gmail but not in Outlook.

Screenshot of the Gmail

Screenshot of the Outlook

Please correct me what I am doing wrong.

Share Improve this question edited Feb 14, 2020 at 12:23 Aleksandr Belugin 2,2271 gold badge16 silver badges20 bronze badges asked Feb 14, 2020 at 12:00 Shubham AzadShubham Azad 7962 gold badges11 silver badges25 bronze badges 3
  • Unfortunately, I don't think it's possible. – Halden Collier Commented Feb 14, 2020 at 12:02
  • 4 Not work with outlook - campaignmonitor./css/color-background/css-gradients – Luís P. A. Commented Feb 14, 2020 at 12:03
  • Although CSS Gradients not supported as mentioned, you could still use an image to do the trick. – Elharony Commented Feb 14, 2020 at 12:32
Add a ment  | 

1 Answer 1

Reset to default 4

Unfortunately, Outlook does not support linear-gradients. Outlook, especially for Windows, primarily supports basic CSS.

See Campaign monitor: https://www.campaignmonitor./css/color-background/css-gradients/

发布评论

评论列表(0)

  1. 暂无评论