5

In my spree store, I am preparing mailer to send email on order confirmation, but CSS property: justify-content is not appearing in the email rendered.

Following is my HTML:

  <div class="banner">
    <img class="height-50perc banner-content" src="https://myUrl" />
    <span class="banner-content">Order confirmed</span>
  </div>

My CSS:

.banner {
  display: flex;
  height: 80px;
  background: linear-gradient(90deg, #2e3092 , #0c5fdc);
  justify-content: space-between;
}

.banner-content {
  margin-top: auto;
  margin-bottom: auto;
  margin-left: 10px;
  margin-right: 10px;
  color: white;
  font-size: 20px;
}

But in email rendered, I don't see property: justify-content. When I inspect corresponding element: it is like this:

<div class="m_2586726072602943149banner" style="background:linear-gradient(90deg,#2e3092,#0c5fdc);display:flex;height:80px">
    ....
</div>

Notice there is no justify-content in this div. I am viewing email in chrome and firefox browser in Mac.

I have also tried changing CSS to:

.banner {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  height: 80px;
  background: linear-gradient(90deg, #2e3092 , #0c5fdc);
  justify-content: space-between;
  -webkit-justify-content: space-between;
}

But this also did not help.

Saurabh
  • 71,488
  • 40
  • 181
  • 244

2 Answers2

2

It seems support of flex is still not proper as explained in this link

Now here are the webmails in which Flexbox is not supported :

  • Yahoo
  • Gmail
  • Outlook.com

Gmail and Outlook.com also filter every properties related to Flexbox, except the property display:flex.

This may be the reason why I am not even able to see the justify-content in rendered email.

Community
  • 1
  • 1
Saurabh
  • 71,488
  • 40
  • 181
  • 244
0

For future reference not all CSS reference is supported in E-mail providers, which is causing such error, each email provider has their own style and support.

You can find the full support list for Gmail from this link:

and the other emails from the mailchimp

a0m0rajab
  • 115
  • 7