Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Put Text Over an Image (in email)?

Tags:

html

css

email

Since this is impossible: ::after for inline HTML email?

How can I put text over the below image?

enter image description here

Keep in mind that position and negative margins don't seem to be supported by email.

<img src="http://www.livetochallenge.com/assets/blue-banner.png">
<div style="display: inline-block;"> # Put this text on banner
  Put<br>
  Over<br>
  Image
</div>
like image 931
AnthonyGalli.com Avatar asked Sep 10 '16 05:09

AnthonyGalli.com


People also ask

How do I put text on top of a picture?

Use a text box to add text on top of a photoOn the Insert tab, in the Text group, click Text Box, drag to draw a text box anywhere near the picture, and then type your text. To change the font or style of the text, highlight the text, right-click it, and then select the text formatting you want on the shortcut menu.

How do you insert text into an email?

Insert text If you paste text from an external source, use the shortcut Ctrl+shift+V to paste as plain text or Ctrl+V to paste from Word. Apply the desired format to it using the various options available in the Styles and Configurations tabs.

How do I put text over an image in HTML?

CSS position property is used to set the position of text over an image. This can be done by enclosing the image and text in an HTML “div”. Then make the position of div “relative” and that of text “absolute”.

How do I edit text in a picture in an email?

Right-click the image and select Edit Alt Text....


1 Answers

When it comes to text-over-image in email, your safest possible route is rendering the text onto the image and providing ALT tags. This gives you 100% assurance that all text will always be on the image, regardless of device or email client. Many clients out there don't support background images, so while you may get it to render properly on one, there's always that user who still uses Outlook from 2009.

Some of my colleagues have used this site with pretty good results: https://backgrounds.cm/ - but again, it won't work on all clients / devices.

Another solution would be to "fudge" the background. For instance, if the text is going to be over a solid color graphic, you can slice that out independently and use a background color. That way the text is still live. For instance - the image you provided appears to be a banner. Maybe the middle part is simply just a TD with a background color of #2E3E65, and the surrounding elements have the banner image that you provided.

With the above said, though, my strong suggestion is to go the image route. Then focus can be put on responsive testing, versus editing. Hope I helped.

EDIT Have a look at this: https://www.campaignmonitor.com/css/ If going the code-route is an absolute must, it's a very handy guide that illustrates what elements / tags / properties work on all major email clients. It can also be beneficial information to pass onto a client if they insist on live-text :-)

EDIT 2

I just did everything inline here. The markup can be heavily cleaned up if you want to toss in a style tag, then just add the styles within there (instead of in the html).

<table style="width:300px; border-collapse: collapse; margin: 0; padding: 0; border: none;">
<tr style="height: 54px;">
<td style="margin: 0; padding: 0; border-collapse: collapse; border: none; width: 36px;"><img src="http://www.livetochallenge.com/assets/blue-banner.png" style="margin: 0; padding: 0;"/></td>
<td style="margin: 0; padding: 0; border-collapse: collapse; border: none;"><div style="background-color: #354871; height: 37px; color: white; text-align: center; padding-top: 15px;"># Put this text on banner</div></td>
<td style="margin: 0; padding: 0; border-collapse: collapse; border: none; width: 36px;"><img src="http://i.imgur.com/OgwtHvr.png" style="margin: 0; padding: 0;"/></td>
</tr>
</table>

This will produce the "fudge" effect as seen below: html banner .

Notes - I just used photoshop to horizontally flip the image. Also, disregard that slight color change. It's just a matter of how I exported the flipped image.

like image 123
Joe Avatar answered Sep 18 '22 18:09

Joe