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>
Related
Is it possible to vertically align table 3 at the bottom in the following example?
This is for a mail signature, hence the use of tables and the hack with align to make the tables responsive (they'll stack underneath each other if viewport gets too small). Now, the client wants the logo in table 3 to be aligned at the bottom (see example image) and I'm beginning to wonder if this is even possible while keeping it mobile friendly.
I've tried vertical-alignment: bottom pretty much everywhere and margin-top: auto; margin-bottom: 0; on table 3 to no avail. I'm guessing the align="left" overrides pretty much ever vertical alignment styling I'm trying to make.
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #000 solid; max-width: 903px; width: 100%">
<tr>
<td>
<!-- "responsive" tables -->
<!-- table 1 -->
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #ff0000 solid; width: 300px;">
<tr>
<td>
Company logo
</td>
</tr>
</table>
<!-- table 2 -->
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #00ff00 solid; width: 300px;">
<tr>
<td>
Contact details<br>
<br>
<br>
</td>
</tr>
</table>
<!-- table 3 -->
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #0000ff solid; width: 300px;">
<tr>
<td>
Another logo
</td>
</tr>
</table>
</td>
</tr>
</table>
You could use a vertical-align and give the cell a height using CSS.
#media (min-width: 1000px) {
.logoHolder td {
height: 50px;
vertical-align: bottom;
}}
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #000 solid; max-width: 903px; width: 100%">
<tr>
<td>
<!-- "responsive" tables -->
<!-- table 1 -->
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #ff0000 solid; width: 300px;">
<tr>
<td>
Company logo
</td>
</tr>
</table>
<!-- table 2 -->
<table align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #00ff00 solid; width: 300px;">
<tr>
<td>
Contact details<br>
<br>
<br>
</td>
</tr>
</table>
<!-- table 3 -->
<table class="logoHolder" align="left" border="0" cellpadding="0" cellspacing="0" style="border: 1px #0000ff solid; width: 300px;vertical-align: bottom;">
<tr>
<td style="vertical-align: bottom;">
Another logo
</td>
</tr>
</table>
</td>
</tr>
</table>
For some reason I can not get the td with 100% inside the table and align the text as center.
How can I make the <td class="order-details"> full width, so it full the 600px of the table obove?
JSFIDDLE: https://jsfiddle.net/61s1cdyo/1/
CODE:
<table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff">
<tr class="details">
<td align="center">
<table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff; max-width: 600px; display: block;">
<tr align="center" class="header">
<td class="order-details">
<h1 style="text-align: left; display: table-cell; padding: 10px 0px;">ORDER DETAILS</h1>
</td>
</tr>
</table>
</td>
</tr>
</table>
Assuming you want to keep the max-width: 600px, you need to remove the display: block from the inner table to make it act like a table.
<table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff">
<tr class="details">
<td align="center">
<table class="table-bestelling-content" cellpadding="0" cellspacing="0" border="0" width="100%" style="background-color:#ffffff; max-width: 600px;">
<tr align="center" class="header">
<td class="order-details">
<h1 style="text-align: left; display: table-cell; padding: 10px 0px;">ORDER DETAILS</h1>
</td>
</tr>
</table>
</td>
</tr>
</table>
Here's a Fiddle
There is a max-width: 600px inline setting for the nested table. If you erase that, it's 100% wide:
https://jsfiddle.net/b594a5d5/1/
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>
I am trying to create an email template like following. I have used table. I am able to do everything except the image is not displayed at proper position. The images should be displayed in middle and on top of the container(see screen 1), but I am not able accomplished it. I have tried to provide negative margin to container, but gmail and other mail services are ignoring the negative margin.
Here's what I was able to accomplishd till so far.
The code is present here. Can anyone please help with this?
Updated answer:
You can't use negative margin in html email. To mimic this, there are 2 ways to do it, the nested tables way and the more complex rowspan way:
<!-- The nested way -->
<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"><!-- coloring the whole table instead of just the cells you want, will stop gaps forming on forwarding from Outlook -->
<tr>
<td width="200" height="80" bgcolor="#007700">
<table width="100%" height="80" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="40" bgcolor="#FFFFFF">
</td>
</tr>
<tr>
<td height="40" bgcolor="#CCCCCC">
</td>
</tr>
</table>
</td>
<td width="100" height="80" bgcolor="#4444FF">
<img alt="" src="" width="100" height="80" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
<td width="200" height="80" bgcolor="#FFFFFF">
<table width="100%" height="80" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="40" bgcolor="#FFFFFF">
</td>
</tr>
<tr>
<td height="40" bgcolor="#CCCCCC">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="500" height="200" colspan="3">
</td>
</tr>
</table>
<br><br>
<!-- The fancy rowspan way -->
<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC"><!-- coloring the whole table instead of just the cells you want, will stop gaps forming on forwarding from Outlook -->
<tr>
<td width="200" height="40" bgcolor="#FFFFFF">
</td>
<td width="100" height="80" rowspan="2" bgcolor="#4444FF">
<img alt="" src="" width="100" height="80" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
<td width="200" height="40" bgcolor="#FFFFFF">
</td>
</tr>
<tr>
<td width="200" height="40">
</td>
<td width="200" height="40">
</td>
</tr>
<tr>
<td width="500" height="200" colspan="3">
</td>
</tr>
</table>
Original answer:
For basic positioning:
Horizontally, use align="left|center|right", vertically use valign="top|middle|bottom"
Here is how to place an image center top of a table:
<table width="500" border="0" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
<tr>
<td height="500" align="center" valign="top">
<img alt="" src="" width="100" height="100" style="margin: 0; border: 0; padding: 0; display: block;">
</td>
</tr>
</table>
As I said:
If it was me i would make the top border and the image a row. – Alex
Thomas 23 mins ago
Change you top row to:
<td valign="bottom">
<b style="border-top-left-radius:5px; background-color:#fff; display:block; border:3px solid #a3a9ac; border-bottom:0; height:100%; margin:0; padding-bottom:20px; border-right:none;"> </b>
</td>
<td class="text-center" width="64">
<img class="top-image" src="https://cdn1.iconfinder.com/data/icons/WPZOOM_Social_Networking_Icon_Set/64/gmail.png"> </td>
<td valign="bottom">
<b style="border-top-right-radius:5px; background-color:#fff; display:block; border:3px solid #a3a9ac; border-bottom:0; height:100%; margin:0; padding-bottom:20px; border-left:none;"> </b>
</td>
check out the result - http://jsfiddle.net/562ux.
I've not tested this in a email Client, but as #Kheema Pandey says, you should try to use inline styles.
It is a good practice to use inline style while creating newsletter. Also outlook doesn't support margin negative property.
in your case the image is not appear center so you can use a inline style here 'style="text-align:center;"'.
<td style="text-align:center;">
<img class="top-image" src="https://cdn1.iconfinder.com/data/icons/WPZOOM_Social_Networking_Icon_Set/64/gmail.png" />
</td>
I need to make a table-based layout and made my table width 550px. And then I loaded an image with original width of 550px but on browser I only have 449px. I want to make in on full width. And also I have extra space between cells.
<table style="width:550px;margin:0 auto;" cellspacing="0" cellpadding="0" border="0">
<tr style="margin:0; padding:0;">
<td style="font-size:12px; line-height: 12px; width: 100%; text-align: right; color:#5A99B1;">Click <b>here</b> for the online version</td>
</tr>
<tr>
<td style="width:100%; height:10px;" cellspacing="0" cellpadding="0">
<img style="width: 100%;" src="border-top.png" />
</td>
</tr>
<tr>
<td style="width:50%; background-color:white;">
<img src="brugadalogo.png" />
</td>
<td style="width:50%; background-color:white; text-align: right;">
<img src="msdlogo.png" />
</td>
</tr>
</table>
Your table columns are not uniformly even. You have 3 rows, the first 2 have 1 column and the last one has 2 columns. Even if you have the right percentages, it is better to have it distributed evenly. Such as have all 3 rows have or "take the space of" 2 columns.
What I mean by that is that instead of using widths, you should use colspan. Also remove the width from the image, if you want its original size, it should get it by default.
<table style="width:550px;margin:0 auto;" cellspacing="0" cellpadding="0" border="0">
<tr style="margin:0; padding:0;">
<td **colspan="2"** style="font-size:12px; line-height: 12px; text-align: right; color:#5A99B1;">Click <b>here</b> for the online version</td>
</tr>
<tr>
<td **colspan="2"** style="height:10px;" cellspacing="0" cellpadding="0">
<img src="border-top.png" />
</td>
</tr>
<tr>
<td style="background-color:white;">
<img src="brugadalogo.png" />
</td>
<td style="background-color:white; text-align: right;">
<img src="msdlogo.png" />
</td>
</tr>
</table>
Hope this solves your issue.