mj-column gets vertically stacked on gmail, on desktop.
See original GitHub issueDescribe the bug mj-column gets vertically stacked on gmail, in both desktop & mobile
To Reproduce Steps to reproduce the behavior:
- Create a file with this MJML code:
<mjml><mj-body><mj-section><mj-column><mj-text>Hello</mj-text></mj-column><mj-column><mj-text>World</mj-text></mj-column></mj-section></mj-body></mjml>
- Convert it to html using mjml 4.2.0, running on a node, express server.
- Send the HTML to an email address.
- See error
Expected behavior mj-column should not vertically stack on desktop.
MJML environment (please complete the following information):
- OS: Ubuntu
- MJML Version: 4.2.0
- MJML tool used: mjml on node and express
Affected email clients (for rendering issues):
- Email Client: Gmail
- Browser Google Chrome
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Compatibility for mj-column - MJML
1Columns are stacked by default, so they appear properly on mobile devices. However, because columns rely on media queries, they do not work ......
Read more >Gmail App: Stacked Column Width Woes (No Media Queries)
We have 1, 2 and 3 column stacks, all of which end up different widths when stacked because max-width has to be set...
Read more >Get Started with MJML: How to Code Responsive Emails
Discover a simple way to develop responsive emails. Find out how to get started with the MJML framework and code mobile-friendly campaigns.
Read more >MJML Not outputting correctly in outlook - Stack Overflow
... padding-bottom="0px" padding-top="0"> <mj-column vertical-align="top" width="100%"> ... This renders perfectly in outlook web and gmail.
Read more >MJML Examples to Get You Started - Scalero
Download the MJML app – this is basically an MJML desktop app, so you'll be able ... It's important to nest the <mj-column>...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
With some intensive testing, I figured out there is probably a css inliner that is causing the issue at one syntax.
When I removed this above code from the generated html, it worked fine even with my server.
It seems like
@viewport
is something which is not supported by the inliner.Try removing the above piece of code from the generated html to see if it works
After a bit of research, I came across this. https://stackoverflow.com/questions/46856100/why-is-gmail-ignoring-my-media-queries-on-ios
So what this suggests is that, basically Gmail will only read the first media query.
So I checked the HTML generated by the above MJML Code. It had two media queries in the document:
I modified the HTML to contain only one, i.e.
And It Worked! The columns are not stacking anymore.
Also, for some reason, when I select the
move to inline
option at putsmail, the columns dont work and they get stacked.Now how did it work with Putsmail before? May be it combines both the style tags, into one. I am not sure.
So I do think this is indeed an MJML issue, and maybe we should reopen this. What do you think?