Position image icon in HTML not working as expected - html

what I need
this is what appearing
I am quite new to HTML and what I want is to have an image icon over another image to clarify more there is a banner and what I need is to have a small icon in the top right corner.
I have used this code
<DIV style="position: relative; top:0px; left:700px; width:200px;
height:5px"><a href="%%ftaf_url%%"><img
src="http://image.S7.exacttarget.com/lib/fe8c13727d67037a74/m/1/ff6a555c-612a-`4609-b5a6-3bc4231cdf86.png" border="0"></a></DIV>
it appears fine in content block but when i send email this icon is always appearing to be in left of screen no matter what I do. I have also used below code but this also doesn't helped.
<div style="display: flex; justify-content: right;">
<img src="http://image.S7.exacttarget.com/lib/fe8c13727d67037a74/m/1/ff6a555c-
612a-4609-b5a6-3bc4231cdf86.png" style="width: 40px; height: 40px;" />
</div>

use the below code
<div style="justify-content: right; text-align: right">
<img src="http://image.S7.exacttarget.com/lib/fe8c13727d67037a74/m/1/ff6a555c-
612a-4609-b5a6-3bc4231cdf86.png" />
</div>

Neither flexbox or position work reliably in HTML Email. Most common way to achieve this is using <table>s instead of <div>s, creating a bunch of table rows, and aligning the content.
Not sure what your code looks like, but something like this will work:
<table role="presentation" aria-hidden="true" cellpadding="0" cellspacing="0" border="0" width="600">
<tr>
<td style="background: url('cross-hatch-background.jpg');">
<table role="presentation" aria-hidden="true" cellpadding="0" cellspacing="0" border="0" width="100%" style="">
<tr>
<td style="padding: 10px;">
<img src="envelope.png" align="right">
</td>
</tr>
<tr>
<td style="padding: 10px;">
<img src="logo.png" align="center">
</td>
</tr>
<tr>
<td style="padding: 10px;">
navigation
</td>
</tr>
</table>
</td>
</tr>
</table>

Related

How do I remove white spaces from an image

I'm trying to remove the extra space for the jcpenney credit card logo.
I tried multiple attempts from border-collapse,display:block and even setting the margin to auto.Any feedback is welcome.Thank You
<table class="Billing-and-Shipping-Information" width="100%" cellpadding="0" cellspacing="0" border="0" align="center" style="background: white; ">
<tr>
<td>
<table class="billing" width="50%" cellpadding="0" cellspacing="0" border="0" align="left" style="background: white;padding-left:20px;margin:auto; ">
<tr>
<td style="margin:0 auto;padding:0px;">
<h3 style="font-family:Arial,Helvetica,sans-serif;font-weight:600;font-size:20px;margin:0 auto;display:block;">Billing Information</h3>
</td>
</tr>
<tr>
<td>
<!--HERE IS THE ISSUE -->
<img src="images/jcpenney.jpg" style="display:block;">
<!-- HERE IS THE ISSUE -->
</td>
<td style="font-family:Arial,Helvetica,sans-serif;font-size:16px;margin:0 auto;">JCP Card *XXXX* </td>
<td style="padding-top:5px;padding-left:24px;font-family:Arial,Helvetica,sans-serif;font-size:16px;font-weight:bold;margin:auto;">$64.94</td>
</tr>
</table>
Your question is not clear. Though you can try this
<td style="text-align:center;>
<img src="images/jcpenney.jpg" style="display:block;">
</td>
or,
<td>
<img src="images/jcpenney.jpg" style="display:block;width:100%;">
</td>
Do you mean the extra white space below the image?
For example, here at this example I did, you can see a white extra space below the astronaut img and you can fix that adding the next property and value to the imgs at yout CSS.
vertical-align: middle;
img {
max-width: 100%;
}
.image-container {
width: 300px;
background-color: red;
}
<div class="image-container">
<img src="https://i.imgur.com/DtxmvLB.jpg" alt="Apollo 11">
</div>

How do I center an image in a table in Outlook

What is the correct inline css to move text or an image center in Outlook. Any time I open it in a browser, it looks great but the bottom image and text always stay left in Outlook. Not sure what else to try. Any help is appreciated
<table cellpadding="0" cellspacing="0" border="0" width="800" align="left">
<table align="left" width="800px;">
<tr width="800px">
<td><img width="800px;" src="images/ArlingtonPic-edited.png"></td>
</tr>
</table>
<table align="left" width="800px;">
<tr width="800px">
<td width="800px" style="font-size:20px; margin-left: auto;
margin-right: auto; text-align: center; vertical-align: middle;">
<strong>Arlington Concrete Floor Boxes</strong></td>
</tr>
</table>
<table align="left" width="800px;">
<tr width="800px">
<td width="350px" style="font-size:16px; padding: -10px 10px 0 10px;">
<p>Our NEW heavy-duty<strong>FLBC4502</strong> 4.5"<strong> concrete floor
box</strong> has more! <strong> <span style="color: red">SIX conduit hubs and FOUR plugs.</span></strong>
And the NEW FLBC4502LR leveling ring makes
installation easier than ever on our FLBC4500
and FLBC4502, and others concrete boxes. <br>
It is <em>REVERSIBLE!</em></p>
</ul>
</td>
<td width="350px" style="font-size:16px; padding: 0 10px;">
<p>The screw holes on SIDE A fit all 4.5" boxes,
and accommodate our 6" round covers,
and most others on the market.
SIDE B features a second set of holes
that fit a cover with a 3-3/8" hole pattern.
These Arlington <strong>cover kits</strong> fit
our concrete boxes. <br>
<em>That is convenience!</em></p>
</td>
</tr>
</table>
<table align="left" width="800px;">
<tr width="800px">
<td width="800px" style="margin-left: auto; margin-
right: auto; text-align: center; vertical-align: middle;">
<img src="images/ArlingtonLogo.png">
</td>
</tr>
</table>
On your table cell use following attributes:
<td valign="middle" align="center">...</td>
for vertical and horizontal align.
This will add image in center in outlook.
<table width="100%">
<tr>
<td align="center">
<img src="https://4de5ad3168da.png" align="middle" width="200" height="130">
</td>
</tr>
</table>

HTML/CSS In-line background image

I am trying to create a single page, will be used as a newsletter, so my code is html/css inline.
http://jsfiddle.net/Chamberja/6t9r14ew/
I want to add a background image behind that entire table so the logo and the text will appear in the foreground.
I have tried adding
style="background-image: url("bg.jpg")"
and
style= "background: url(bg.jpg)"
So the final code looks like
<table style="background: url(sportip.biz/alpha.jpg)" border="0" cellpadding="0" cellspacing="0" align="left" class="deviceWidth">
<tr>
<td style="padding:10px 20px" class="center">
<img src="http://sportip.biz/nlsiplogo.jpg" alt="" border="0" />
</td>
</tr>
</table>
I think I am doing the in-line wrong.
I hope this is what you looking for:
<table style="background: url(sportip.biz/alpha.jpg)" border="0" cellpadding="0" cellspacing="0" align="left" class="deviceWidth">
<tr>
<td style="padding: 10px 20px" class="center">
<img src="http://sportip.biz/nlsiplogo.jpg" alt="" border="0" />
</td>
</tr>
</table>
<!-- End Logo -->
<!-- Nav -->
<table style="position: absolute; margin-top: 0; margin-left: 0;" border="0" cellpadding="0" cellspacing="0" align="right" class="deviceWidth">
<tr>
<td class="center" style="font-size: 13px; color: #272727; font-weight: light; text-align: right; font-family: Georgia, Times, serif; line-height: 20px; vertical-align: middle; padding:10px 20px; font-style:italic">
<b>Dear #name#,
Check out the latest releases of our magazines</b>
</td>
</tr>
</table>
Here's the fiddle.
jsfiddle.net/shanidkv/g0dd3vcm/1/
Find the updated JSfiddle code.
Note: Try to copy and past above url to browser facing some problem to attach link directly or on top of text
Many email clients do not support rendering a background image inside a table. See here for some examples of workarounds: http://blog.mailermailer.com/email-design/background-images-in-html-email-the-naked-truth

Placing Anchored Images on top of table background for email template

I have the following code for a background Image on a table, which has some image links on top of it as well as a logo. I am using a mailchimp account and I would like to make the background editable. it is not possible to make background images editable.
So I am wondering about alternative solutions to have the social links and logo on top of a image while still allowing a image underneath to be editable, so background image without a background property in a table, that is compatible in most email clients, that allows for editing in Mailchimp.
<table mc:edit="backgroundImage" class="backgroundHeader" background="http://104.131.7.150/public/vancouverSunrise.jpg" border="0" cellpadding="0" height="400" cellspacing="0" width="100%">
<tr valign="top">
<td>
<div align="right" style="padding: 40px 15px 0px 15px;">
<table border="0" cellpadding="0" cellspacing="0" width="30">
<!-- LOGO/PREHEADER TEXT -->
<tr align="right">
<td><a mc:edit="linkedin" href="*|CUSTOM_URL|*"><img src="linkedin.png" width="46.6" height="44" /></a></td>
<td><a mc:edit="facebook" href="*|CUSTOM_URL|*"><img src="facebook.png" width="46.6" height="44" /></a></td>
<td><a mc:edit="twitter" href="*|CUSTOM_URL|*"><img src="twitter.png" width="46.6" height="44" /></a></td>
</tr>
</table>
</div>
</td>
</tr>
<tr valign="top">
<td>
<div align="center" style="padding: 10px 15px 0px 15px;">
<table border="0" cellpadding="0" cellspacing="0" width="30" class="wrapper">
<!-- LOGO/PREHEADER TEXT -->
<tr align="center">
<td><img src="image.png" width="244" height="126.6" /></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
You can't use z-index either so hacking an img on top of another is impossible.
You need to have a set up based around the code from http://backgrounds.cm/ and have your mc:edit attributes get to the filename in both the background attribute of the TD (not the table, table backgrounds don't work in most clients) and the VML script from the generated code. You also need to update the height and width attributes on the TD and VML.

width for <td> in GMail has no effect

I have a design for HTML emails which must display like
| image'a'here<<<<<<<<<<<space>>>>>>>>>>>>>>>>>image'b'here |
<table class="wrapper">
<tr>
<td class="header" style="padding: 15px 15px 0;">
<table class="max-width" cellspacing="0" cellpadding="0" style="width: 100%;">
<tr>
<!--RB logo-->
**<td style="width: 93% !important;vertical-align: top;">**
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<a class="link-style" href="https://www.reportbee.com/" target="_blank">
<img src="https://gallery.mailchimp.com/0135a40176b33deb024da1fea/images/d86f927a-3eef-4e8f-9dae-99753e62b0b5.png" alt="Report Bee" title="Report Bee"></a>
</td>
</tr>
</table>
</td>
<!--RB flag-->
<td>
<table class="block" cellspacing="0" cellpadding="0">
<tr>
<td> <img src="https://gallery.mailchimp.com/0135a40176b33deb024da1fea/images/2cddc1b3-1e85-4759-8cb1-7e07e9a2d89c.png" alt=""></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
I tried to specify width for the which contains my first image. But Gmail doesnot accept the width for and it displays my email as
| image'a'here image'b'here |
what am I doing wrong?
When I want two images to sit at opposite ends of an email, I use:
<td width="40" align="left"><img></td>
<td width="100%"><img></td>
<td width="40" align="right"><img></td>
As both images have fixed widths, the spacer in the centre that is 100% pushes the images to the outside.
if you are sending html email just pass following info in header
MIME-Version: 1.0
Content-type:text/html;charset=UTF-8
Main things is content type: **Content-type:text/html**
pass content type text/html for html email
i have experienced a problem like this before.. after doing a lot of research online, i came to know style tag and any most of the css elements will not work in gmail and outlook
so if you are giving a width for td please make it like td width=" " then you can see the effect