I currently have a smart rich text module in my weekly customer email that is not rendering correctly when viewed on mobile in Gmail app. My developer help is on vacation this week but told me 2 weeks ago that it was a "gmail issue" and he would have to research it. And then he went on vacation.
Could someone please help me figure this out? Here is my code and what it looks like in Gmail. How do I get the text and image to center on the mobile email in Gmail? Thanks for ANY help you can provide.
<style type="text/css"> @media screen and (max-width: 600px) {
.email-container { width: 100% !important; }
/* What it does: Forces elements to resize to the full width of their container. Useful for resizing images beyond their max-width. */ .fluid, .fluid-centered { max-width: 100% !important; height: auto !important; margin-left: auto !important; margin-right: auto !important; width: 100% !important; } /* And center justify these ones. */ .fluid-centered { margin-left: auto !important; margin-right: auto !important; }
/* What it does: Forces table cells into full-width rows. */ .stack-column, .stack-column-center { display: block !important; width: 100% !important; max-width: 520px !important; direction: ltr !important; } /* And center justify these ones. */ .stack-column-center { text-align: center !important; }
/* What it does: Generic utility class for centering. Useful for images, buttons, and nested tables. */ .center-on-narrow { text-align: center !important; display: block !important; margin-left: auto !important; margin-right: auto !important; float: none !important; } table.center-on-narrow { display: inline-block !important; } .center-on-narrow { }
<table align="center" border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td class="stack-column-center"><table align="left" border="0" cellpadding="0" cellspacing="0" width="70%" class="stack-column-center"> <tr> <td dir="ltr" valign="top" style="font-family: sans-serif; font-size: 13px; mso-height-rule: exactly; line-height: 20px; text-align: left;" class="center-on-narrow">Sign in to <a href="https://www.constellationrewards.com/" style="font-weight: bold;" rel="noopener"><span style="color: #2372b9;">Constellation Rewards</span></a><span style="font-weight: normal;"> today to use your Reward Dollars to save on hundreds of gift cards like L.L. Bean, Macy’s, Office Depot, Old Navy, and more! Save now on dining, travel, entertainment, shopping and more. Log in to start saving today!<br><br></span>
You can also check the hs-inline-css option at the article Email template markup and look at hs-inline-css and data-hse-inline-css. to add style elements inline. Ofcourse this won't do media queries since you can't do inline media queries on elements.
I posted my result of doing what you suggested last week and the mobile formatting still looks incorrect in gmail. Is there no solution for this? Please let me know. Thanks.
/* What it does: Forces elements to resize to the full width of their container. Useful for resizing images beyond their max-width. */ .fluid, .fluid-centered { max-width: 100% !important; height: auto !important; margin-left: auto !important; margin-right: auto !important; width: 100% !important;
} /* And center justify these ones. */ .fluid-centered { margin-left: auto !important; margin-right: auto !important; }
/* What it does: Forces table cells into full-width rows. */ .stack-column, .stack-column-center { display: block !important; width: 100% !important; max-width: 100% !important; direction: ltr !important; } /* And center justify these ones. */ .stack-column-center { text-align: center !important; }
/* What it does: Generic utility class for centering. Useful for images, buttons, and nested tables. */ .center-on-narrow { text-align: center !important; display: block !important; margin-left: auto !important; margin-right: auto !important; float: none !important; } table.center-on-narrow { display: inline-block !important; } .center-on-narrow { }
@LoraBergeron You can't put a <head> tag in the body of the email which is where an HTML module is rendering it's code. As I said, you can't edit the head in a drag and drop email (which from this screen shot shows that's what it is) so there's nothing that can be done to fix it.
If this answer solved your question, please mark it as the solution.
Aug 26, 202110:39 AM - edited Aug 26, 202110:43 AM
Contributor
Rich text email for viewing in Gmail
Hi Alyssa,
I just tried what Indra suggested and I posted the results below. Are you saying that there is nothing that can be done in the drag and drop format, and this email will never look correct in gmail?
@LoraBergeron It looks like your center styling is in the body of the code. Gmail strips out any styling that's not in the <head></head>. Move all your <style> blocks to the <head> and it should work. If this is a Drag and Drop email (not design manager) then there's nothing you can do about that because Hubspot does not give us access to the <head> (which I hope at some point they do).
If this answer solved your question, please mark it as the solution.
No, that did not help. We aren't able to figure out why the email content isn't rendering correctly in Gmail. The code is there but it doesn't look right. No one at my company can figure out why. I'm pasting to code here and attaching what it looks like on mobile in gmail.
Could you please look at the code and make sure we aren't doing something wrong?
<style type="text/css"> @media screen and (max-width:560px) {
.email-container { width: 100% !important; }
/* What it does: Forces elements to resize to the full width of their container. Useful for resizing images beyond their max-width. */ .fluid, .fluid-centered { max-width: 100% !important; height: auto !important; margin-left: auto !important; margin-right: auto !important; width: 100% !important;
} /* And center justify these ones. */ .fluid-centered { margin-left: auto !important; margin-right: auto !important; }
/* What it does: Forces table cells into full-width rows. */ .stack-column, .stack-column-center { display: block !important; width: 100% !important; max-width: 100% !important; direction: ltr !important; } /* And center justify these ones. */ .stack-column-center { text-align: center !important; }
/* What it does: Generic utility class for centering. Useful for images, buttons, and nested tables. */ .center-on-narrow { text-align: center !important; display: block !important; margin-left: auto !important; margin-right: auto !important; float: none !important; } table.center-on-narrow { display: inline-block !important; } .center-on-narrow { }