mjmlio / mjml

MJML: the only framework that makes responsive-email easy
https://mjml.io
MIT License
17.08k stars 960 forks source link

Several columns - outlook.live.com #837

Closed JustineCosson closed 7 years ago

JustineCosson commented 7 years ago

Hi,

I have a problem with outlook.live.com : I have several columns in my Mjml, and instead of appearing side by side, they appear one below the other. I read in the other posts that we had to add the prefix [owa] in the media queries, I did, but that does not solve my problem.

Here is my Mjml :

<mjml>
<mj-head>
  <mj-font name="Raleway" href="https://fonts.googleapis.com/css?family=Raleway:400,500,600" />
</mj-head>

<mj-body>
  <mj-container background-color="#E3E3E3">
    <mj-section>
      <mj-column width="48%">
        <mj-image src="https://cdn.static01.nicematin.com/media/npo/600w/2017/10/rcaxxq200_ff_defile-a-22083742.jpg" href="#"></mj-image>
        <mj-text><a href="#" style="color:#05377e;text-decoration:none;">#cote d'azur</a></mj-text>
        <mj-text><a href="#" style="color:black;text-decoration:none;">Title</a></mj-text>
      </mj-column>
      <mj-column width="4%">
      </mj-column>
      <mj-column width="48%">
        <mj-image src="https://cdn.static01.nicematin.com/media/npo/600w/2017/10/rcaxxq200_ff_defile-a-22083742.jpg" href="#"></mj-image>
        <mj-text><a href="#" style="color:#05377e;text-decoration:none;">#cote d'azur</a></mj-text>
        <mj-text><a href="#" style="color:black;text-decoration:none;">Title</a></mj-text>
      </mj-column>
  </mj-section>
</mj-container>
</mj-body>
</mjml>

and here is my html :

<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<head>
  <title></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">
<style type="text/css">
  #outlook a { padding: 0; }
  .ReadMsgBody { width: 100%; }
  .ExternalClass { width: 100%; }
  .ExternalClass * { line-height:100%; }
  body { margin: 0; padding: 0; -webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; }
  table, td { border-collapse:collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; }
  img { border: 0; height: auto; line-height: 100%; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; }
  p { display: block; margin: 13px 0; }
</style>
<!--[if !mso]><!-->
<style type="text/css">
  @media only screen and (max-width:480px) {
    @-ms-viewport { width:320px; }
    @viewport { width:320px; }
  }
</style>
<!--<![endif]-->
<!--[if mso]>
<xml>
  <o:OfficeDocumentSettings>
    <o:AllowPNG/>
    <o:PixelsPerInch>96</o:PixelsPerInch>
  </o:OfficeDocumentSettings>
</xml>
<![endif]-->

<!--[if !mso]><!-->
    <link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet" type="text/css">
    <style type="text/css">

        @import url(https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700);

    </style>
  <!--<![endif]--><style type="text/css">
  @media only screen{
    .mj-column-per-48 { width:48%!important; }
.mj-column-per-4 { width:4%!important; }
[owa] .mj-column-per-48 { width:48%!important; }
[owa] .mj-column-per-4 { width:4%!important; }
  }
</style>
</head>
<body style="background: #E3E3E3;">

  <div class="mj-container" style="background-color:#E3E3E3;"><!--[if mso | IE]>
      <table role="presentation" border="0" cellpadding="0" cellspacing="0" width="600" align="center" style="width:600px;">
        <tr>
          <td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;">
      <![endif]--><div style="margin:0px auto;max-width:600px;"><table role="presentation" cellpadding="0" cellspacing="0" style="font-size:0px;width:100%;" align="center" border="0"><tbody><tr><td style="text-align:center;vertical-align:top;direction:ltr;font-size:0px;padding:20px 0px;"><!--[if mso | IE]>
      <table role="presentation" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td style="vertical-align:top;width:288px;">
      <![endif]--><div class="mj-column-per-48 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap:break-word;font-size:0px;padding:10px 25px;" align="center"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="center" border="0"><tbody><tr><td style="width:238px;"><a href="#" target="_blank"><img alt="" title="" height="auto" src="https://cdn.static01.nicematin.com/media/npo/600w/2017/10/rcaxxq200_ff_defile-a-22083742.jpg" style="border:none;border-radius:0px;display:block;font-size:13px;outline:none;text-decoration:none;width:100%;height:auto;" width="238"></a></td></tr></tbody></table></td></tr><tr><td style="word-wrap:break-word;font-size:0px;padding:10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;"><a href="#" style="color:#05377e;text-decoration:none;">#cote d'azur</a></div></td></tr><tr><td style="word-wrap:break-word;font-size:0px;padding:10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;"><a href="#" style="color:black;text-decoration:none;">Title</a></div></td></tr></tbody></table></div><!--[if mso | IE]>
      </td><td style="vertical-align:top;width:24px;">
      <![endif]--><div class="mj-column-per-4 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody></tbody></table></div><!--[if mso | IE]>
      </td><td style="vertical-align:top;width:288px;">
      <![endif]--><div class="mj-column-per-48 outlook-group-fix" style="vertical-align:top;display:inline-block;direction:ltr;font-size:13px;text-align:left;width:100%;"><table role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"><tbody><tr><td style="word-wrap:break-word;font-size:0px;padding:10px 25px;" align="center"><table role="presentation" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0px;" align="center" border="0"><tbody><tr><td style="width:238px;"><a href="#" target="_blank"><img alt="" title="" height="auto" src="https://cdn.static01.nicematin.com/media/npo/600w/2017/10/rcaxxq200_ff_defile-a-22083742.jpg" style="border:none;border-radius:0px;display:block;font-size:13px;outline:none;text-decoration:none;width:100%;height:auto;" width="238"></a></td></tr></tbody></table></td></tr><tr><td style="word-wrap:break-word;font-size:0px;padding:10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;"><a href="#" style="color:#05377e;text-decoration:none;">#cote d'azur</a></div></td></tr><tr><td style="word-wrap:break-word;font-size:0px;padding:10px 25px;" align="left"><div style="cursor:auto;color:#000000;font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:22px;text-align:left;"><a href="#" style="color:black;text-decoration:none;">Title</a></div></td></tr></tbody></table></div><!--[if mso | IE]>
      </td></tr></table>
      <![endif]--></td></tr></tbody></table></div><!--[if mso | IE]>
      </td></tr></table>
      <![endif]--></div>
</body>
</html>

Are there any extra actions to do so that outlook takes these columns into account?

Thank you for your help

Rick8rooke commented 7 years ago

Im having the same issue - in Outlook.live.com and mjml columns are appearing as rows, is there a fix for this?

iRyusa commented 7 years ago

Hi here,

There's no way to differentiate between Desktop and Mobile in outlook.com so by default we're displaying the mobile version ( hoping that outlook.com will finally support media queries one day )

You can override the behaviour as you've said in your first post with [owa] selector but that shouldn't live inside a media query just in a regular mj-style example here: https://mjml.io/try-it-live/Bksfwfp3Z

Note by doing that mobile outlook.com users will see a desktop version of the email

We're discussing about a new attribute in MJML4 to avoid doing this manually image

JustineCosson commented 7 years ago

Thank you so much for your help !