Creating an email template with text box overlapping an image

I am trying to create an email marketing template that has a text box slightly overlapping an image box above. For the text box I am using an HTML module and have set the position: relative with a margin-top: -10% and a background-color:#7eb8ba.

In Gmail the position: relative does not hold and the text box sits flush under the image.

Any suggestions?

Below is a screenshot of what I want it to look like:

@lwest126 I found this answer to a similar question, where the answer was to use CSS on the module. I’m not sure if that’s what you’re already doing, or if it helps, but it’s the best I could find.

position: relative;
z-index: 10;
top: -100px;

As far as I know and tested things around, negative values, positioning and z-index values are not supported in most of e-mail browsers like Gmail or MS Outlook. Most of the email templating support have apple devices. Also when templating e-mails, all the css should be written inside the style=“” attributes. Most of the coding solutions for drag and drop e-mail templates can be made only with the usage of tables.

For your example above I managed to code up a solution that works in most cases:

<!-- email content in here -->
<table role=“presentation” align=“center” border=“0” cellpadding=“0” cellspacing=“0” width=“100%”>
<tr>
<td valign=“top”>
<div style=“max-height:{{ module.space_from_top }}px; margin: 0 auto; text-align: center;”>
<img class=“reset” src=“{{ module.background_image.src }}” width=“600” height=“{{module.divider_height}}” border=“0” alt=“” style=“vertical-align: middle;”/>
</div>
<!-- TEXT BLOCK START -->
<table role=“presentation” class=“faux-absolute reset” align=“center” border=“0” cellpadding=“0” cellspacing=“0” width=“600” style=“position:relative; opacity:0.999;”>
<tr>
<td valign=“top”>
<!--[if mso]>
<v:rect xmlns:v=“urn:schemas-microsoft-com:vml” stroked=“false” filled=“false” style=“width:600px;height:300px;”>
<v:textbox inset=“0,-60px,0,0”>
<![endif]-->
<table role=“presentation” class=“hero-textbox” border=“0” cellpadding=“0” cellspacing=“0” width=“65%” bgcolor=“#FFFFFE” align=“center”>
<tr>
<td valign=“top” style=“padding: 40px;”>
<h1 style=“margin: 0; font-family:sans-serif; mso-line-height-rule: exactly; line-height: 1.5; text-align:center;”>
{% inline_rich_text field=“heading” value=“{{ module.heading }}” %}
</h1>
<br>
<p class=“left” style=“margin: 0; font-family:sans-serif; font-size:1em; mso-line-height-rule: exactly; line-height: 1.5; text-align:center;”>
{% inline_rich_text field=“body_text” value=“{{ module.body_text }}” %}
</p>
</td>
</tr>
</table>
<!--[if mso]>
</v:textbox>
</v:rect>
<![endif]-->
</td>
</tr>
</table>
<div style=“height: 40px;”></div>
</td>
</tr>
</table>


@lwest126 wrote:

I am trying to create an email marketing template that has a text box slightly overlapping an image box above. For the text box I am using an HTML module and have set the position: relative with a margin-top: -10% and a background-color:#7eb8ba.

In Gmail the position: relative does not hold and the text box sits flush under the image.

Any suggestions?

Below is a screenshot of what I want it to look like:


Hi @DKirbim, hope you are doing well!

Thanks for sharing :slightly_smiling_face:

Best,

Diana