I've been trying to create a pdf of a mediawiki page with mpdf and wverything is fine, except all tables that are not correctly rendered.
I have isolated the problem and to reproduce it I create a simple example that shows what Im facing in there..
When trying to render the following table:
<style>
.wikitable tbody tr th, table.jquery-tablesorter thead tr th.headerSort, .header-cell {
background: #009999;
color: white;
font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
font-weight: bold;
font-size: 13pt;
}
.wikitable, table.jquery-tablesorter {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
}
.tabela, .wikitable {
border: 1px solid #A2A9B1;
border-collapse: collapse;
}
.tabela tbody tr td, .wikitable tbody tr td {
padding: 5px 10px 5px 10px;
border: 1px solid #A2A9B1;
border-collapse: collapse;
}
.config-value {
font-family: "Courier New", Courier, "Lucida Sans Typewriter", "Lucida Typewriter", monospace;
font-size:13pt;
background: white;
font-weight: bold;
}
</style>
<table class="wikitable tabela">
<tr>
<th colspan="4"> SAP</th>
</tr>
<tr>
<td style="text-align: center;"> Servidor SAP </td>
<td class="config-value" colspan="3"> 10.18.254.71</td>
</tr>
<tr>
<td style="text-align: center;"> Instance Number</td>
<td class="config-value"> 00 </td>
<td style="text-align: center;"> System ID</td>
<td class="config-value"> 500</td>
</tr>
<tr>
<td style="text-align: center;"> Usuário</td>
<td class="config-value"> 234234 </td>
<td style="text-align: center;"> Senha</td>
<td class="config-value"> dev#2543</td>
</tr>
<tr>
<td style="text-align: center;"> Depósito</td>
<td class="config-value"> AWS </td>
<td style="text-align: center;"> Centro </td>
<td class="config-value"> 001</td>
</tr>
<tr>
<td style="text-align: center;"> Sistema de Depósito</td>
<td colspan="3" class="config-value"> WHY</td>
</tr>
<tr>
<td style="text-align: center;">SAP Router</td>
<td colspan="3" style=""text-align:left;" class="config-value"></td>
</tr>
</table>
we get the following result:
mpdf output
As the browser render as:
Table rendered by browser
The php code is:
<?php
require_once __DIR__ . '/mpdf/vendor/autoload.php';
$mpdf =new \Mpdf\Mpdf([
'mode' => 'utf-8'
]);
$mpdf->shrink_tables_to_fit = 0;
$mpdf->keep_table_proportions = true;
$html = file_get_contents('c:\TMP\html.html');
$mpdf->WriteHTML( $html );
$mpdf->Output( 'saida.pdf', 'F' );
How to make mpdf render the table correctly?
I resolved my issue aplying inline style using https://github.com/MyIntervals/emogrifier.
Related
I try to add a custom color to a link inside a div but its not working, the color does not change. Why is that?
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<style>
.navigation-div a {
display: block;
font-size: 18px;
color: #14133b !important;
line-height: 1;
margin-bottom: 26px;
}
.navigation-div a:hover {
color: #CEA941 !important;
}
.navigation-div a:visited {
color: #14133b !important;
}
.navigation-div a:link {
color: #14133b !important;
}
.navigation-div a:visited {
color: #14133b !important;
}
</style>
</head>
<body>
<table class="table" style="border-bottom: 0px solid black;">
<tbody><tr>
<td valign="top"></td>
<td valign="top">header 1</td>
<td valign="top">header 2</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td valign="top"></td>
<td><div class="navigation-div">
Motor </div>
</td>
<td><div class="navigation-div">
12345 </div>
</td>
</tr>
</tbody></table>
</body>
</html>
So since you're using a table you have to go through each element like this :
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<style>
/* a{
color: black;
}
a:hover{
color: reds;
} */
table> tbody > tr>td>.navigation-div >a:hover{
color: red;
}
</style>
</head>
<body>
<table class="table" style="border-bottom: 0px solid black;">
<tbody>
<tr>
<td valign="top"></td>
<td valign="top">header 1</td>
<td valign="top">header 2</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td valign="top"></td>
<td><div class="navigation-div">
Motor </div>
</td>
<td><div class="navigation-div">
12345 </div>
</td>
</tr>
</tbody></table>
</body>
</html>
Remove the important keyword from your style in .navigation-div a, a: link and a:visited (you dont need the important keyword anywhere):
.navigation-div a {
display: block;
font-size: 18px;
color: #14133b;
line-height: 1;
margin-bottom: 26px;
}
You're overwriting your hover styles with the :link selector a couple of lines later. In general, try and avoid overusing !important - there's no need for it in this situation. Try this:
.navigation-div a {
display: block;
font-size: 18px;
color: #14133b;
line-height: 1;
margin-bottom: 26px;
}
.navigation-div a:hover {
color: #CEA941;
}
.navigation-div a:visited {
color: #14133b;
}
<table class="table" style="border-bottom: 0px solid black;">
<tbody>
<tr>
<td valign="top"></td>
<td valign="top">header 1</td>
<td valign="top">header 2</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td valign="top"></td>
<td>
<div class="navigation-div">
Motor </div>
</td>
<td>
<div class="navigation-div">
12345 </div>
</td>
</tr>
</tbody>
</table>
If you really need to keep the !important rules, you can just move your :hover style underneath the :link
<!DOCTYPE HTML>
<html>
<head>
<title>Untitled</title>
<style>
.navigation-div a {
display: block;
font-size: 18px;
color: #14133b !important;
line-height: 1;
margin-bottom: 26px;
}
td .navigation-div a:hover {
color: #CEA941 !important;
}
.navigation-div a:visited {
color: #14133b !important;
}
.navigation-div a:link {
color: #14133b !important;
}
.navigation-div a:visited {
color: #14133b !important;
}
</style>
</head>
<body>
<table class="table" style="border-bottom: 0px solid black;">
<tbody><tr>
<td valign="top"></td>
<td valign="top">header 1</td>
<td valign="top">header 2</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td valign="top"></td>
<td><div class="navigation-div">
Motor </div>
</td>
<td><div class="navigation-div">
12345 </div>
</td>
</tr>
</tbody></table>
</body>
</html>
use this code . it's work .
All those !important "collide" with each other; simply maintaining the one assigned to the navigation-div a:hover should be enough. Try not overuse the !important keyword, usually it's not the best thing to do.
In your code, the color property of navigation-div a:hover was overwritten multiple times by the other selectors. The only one that should prevail on the others, for your intended behavior, is the hover one, in fact you could also omit the other selectors and so the use of !important.
.navigation-div a {
display: block;
font-size: 18px;
color: #14133b;
line-height: 1;
margin-bottom: 26px;
}
.navigation-div a:hover {
color: #cea941;
}
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
</head>
<body>
<table class="table" style="border-bottom: 0px solid black">
<tbody>
<tr>
<td valign="top"></td>
<td valign="top">header 1</td>
<td valign="top">header 2</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td valign="top"></td>
<td>
<div class="navigation-div">
Motor
</div>
</td>
<td>
<div class="navigation-div">
12345
</div>
</td>
</tr>
</tbody>
</table>
</body>
</html>
I’ve set up the POST SMTP plugin, and I’m getting the emails. However its not arriving as HTML format, even though Post SMTP log shows it as a HTML. The content of the email is correct, only problem it shows as plain text. Any idea how can i fix this?
Code that sends the email is:
add_filter( 'wp_mail_content_type', 'set_html_content_type' );
try { wp_mail($to, $subject, $this->getResult()); }
catch (Exception $e) { $result = false; }
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
function set_html_content_type() {
return 'text/html';
}
Here is the email I get:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="hu">
<head>
<meta charset="utf-8" />
<meta name="author" content="DYB Group - http://dyb.hu/" />
<meta name="Description" content='' />
<title>i-Cell díjbekérő</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" border="0" width="98%" style="background:#f4f4f4; font-family: Arial; font-size: 16px; color:#404040; text-align:center; table-layout:fixed;">
<tr style="line-height:0px;">
<td> </td>
<td width="1000" height="80" >Dokumentum letöltése PDF formátumban:kattintson ide</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="1000" style="background:#fff; line-height:24px;">
<table width="1000" cellpadding="0" cellspacing="0" border="0" style="border-bottom:2px solid #ccc; text-align:left; table-layout:fixed;">
<tr>
<td> </td>
<td width="800" style="font-family: Arial; vertical-align:middle;">
<h1 style='text-align: left; text-transform:uppercase; color:#666; font-size:24px; font-family: Verdana; vertical-align:middle;'>
<img src="http://icell.hu/mail/fejlec.jpg" alt="i-Cell" height="60px">
Díjbekérő
</h1>
<table style="width: 100%; table-layout:fixed;">
<tr>
<td style="border: 1px solid #ccc; white-space: nowrap; padding:20px;" valign="top" width='50%'>
<h2 style='text-transform:uppercase; color:#f36f21; font-size:18px; font-weight:normal; font-family: Verdana;'>Szállító</h2>
<p>
<strong style="font-size: 18px;">i-Cell Kft</strong><br />
<span style="font-size: small;">1143 Budapest</span><br />
<span style="font-size: small;">Hungária köz 5.</span><br />
<span style="font-size: small;">Adószám: 11756420-2-42</span><br />
<span style="font-size: small;">Cégj. szám: 01-09-674965</span><br />
<span style="font-size: small;">Bank neve: MKB Bank Zrt.</span><br />
<span style="font-size: small;">SWIFT: MKKBHUHB</span>
</p>
</td>
<td style="border: 1px solid #ccc; padding:20px" valign="top">
<h2 style='text-transform:uppercase; color:#f36f21; font-size:18px; font-weight:normal; font-family: Verdana;'>Vevő</h2>
<p>
<strong style="font-size: 18px;">Tóth András</strong><br />
<span style="font-size: small;">Ország: Magyarország</span><br />
<span style="font-size: small;">Székhely: 1112, Budapest, Löveg utca 3/f, 2/2</span><br />
<span style="font-size: small;">Szállítási cím: Magyarország: 1112, Budapest, Löveg utca 3/f, 2/2</span><br />
<span style="font-size: small;">Adószám: 0123456789</span><br />
<span style="font-size: small;">E-mail: totand92#gmail.com</span><br />
<span style="font-size: small;">Mobilszám: 203169271</span><br />
<span style="font-size: small;">Fizetési mód: Banki átutalás</span><br />
</p>
</td>
</tr>
</table>
<table style="width: 100%; table-layout:fixed;">
<tr>
<td style="text-align: center; padding-top:20px;">
<span style="font-size:16px; text-transform:uppercase; color:#f36f21; margin-top:20px; font-family: Verdana;">Díjbekérő sorszáma</span>
</td>
<td style="text-align: center; padding-top:20px;">
<span style="font-size:16px; text-transform:uppercase; color:#f36f21; margin-top:20px; font-family: Verdana;">Díjbekérő kelte</span>
</td>
<td style="text-align: center; padding-top:20px;">
<span style="font-size:16px; text-transform:uppercase; color:#f36f21; margin-top:20px; font-family: Verdana;">Fizetési határidő</span>
</td>
</tr>
<tr>
<td style="text-align: center;"><span style="font-size: small;">D18/2775</span></td>
<td style="text-align: center;"><span style="font-size: small;">2018-08-14</span></td>
<td style="text-align: center;"><span style="font-size: small;">2018-08-21</span></td>
</tr>
</table>
<div>
<table style="width: 100%; text-align:left; table-layout:fixed;" cellpadding="4">
<tr>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>Termék neve</strong></span>
</td>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>Mennyiség (db)</strong></span>
</td>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>Egységár (HUF)</strong></span>
</td>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>Nettó összesen (HUF)</strong></span>
</td>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>ÁFA kulcs (%)</strong></span>
</td>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>ÁFA (HUF)</strong></span>
</td>
<td style="background:#f5f5f5; border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>Bruttó összesen (HUF)</strong></span>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>OBU S550</strong></span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">1</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">29900</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">29900</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">27</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">8073</span>
</td>
<td style="border: 1px solid #ccc; text-align: right; padding-right: 20px;">
<span style="font-size: small;">37973</span>
</td>
</tr>
<tr>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;"><strong>Kiszállítási költség</strong></span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">1</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">0</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">0</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">27</span>
</td>
<td style="border: 1px solid #ccc; text-align: center; padding: 2px;">
<span style="font-size: small;">0</span>
</td>
<td style="border: 1px solid #ccc; text-align: right; padding-right: 20px;">
<span style="font-size: small;">0</span>
</td>
</tr>
</table>
<table style="width: 100%; margin-bottom: 0; table-layout:fixed;">
<tr>
<td style="background-color: #f36f21; width: 60%; padding-left: 20px; height:40px;">
<span style="font-size: 16px; color:#fff">
<strong>Számlaszám: (HU11) 10300002-10590929-49020015</strong>
</span>
</td>
<td style="background-color: #f36f21; width: 40%; padding-left: 20px; height:40px;">
<span style="font-size: 16px; color:#fff"><strong>Fizetendő: 37973 HUF</strong></span>
</td>
</tr>
</table>
</div>
<table>
<tr>
<td align="center" style="font-size: small; padding-bottom: 1em; text-decoration: underline;">
<strong>
Amennyiben az Ön cége EU tagországbeli, akkor kérjük, fokozottan ügyeljen az EU adószám pontos megadására! Hibásan megadott EU adószám esetén sajnos nincs módunkban ÁFA mentes számlát küldeni, így ebben az esetben a számlán fel fogjuk számítani a magyar törvények szerinti 27 % ÁFA-t!
</strong>
</td>
</tr>
<tr>
<td align="center" style="font-size: small; padding-bottom: 1em; text-decoration: underline;">
<strong>A díjbekérő fizetési kötelezettséget nem tartalmaz!</strong>
Jelen díjbekérő ÁFA visszaigénylésre nem jogosít.
</td>
</tr>
<tr>
<td align="center" style="font-size: small; padding-bottom: 1em;">
Kérjük, hogy a megrendelt termékek ellenértékeként utalja át a jelen Díjbekérőn szereplő összeget az i-Cell Kft. számlaszámára.
<strong style="color:#f36f21">Kérjük fizetéskor – a banki megjegyzés rovatban - mindig hivatkozzon a díjbekérő (vagy az OBU) sorszámára!</strong>
A pénzügyi teljesítést követően a számlát a megrendelt termékekkel együtt küldjük ki.
</td>
</tr>
<tr>
<td align="center" style="font-size: small; padding-bottom: 1em;">
A pontatlan adatmegadás (szállítási cím, értesítési mobil szám) miatt a termékek ismételt kézbesítéséből származó esetleges pluszköltség a Vevőt terheli.
</td>
</tr>
<tr>
<td align="center" style="font-size: small; padding-bottom: 1em;">
Magyarországon belüli termék kiszállítás esetén a szállítás díját 10.000 Ft feletti megrendelés esetén az i-Cell Kft. fizeti, a Vevő részére díjmentes.
</td>
</tr>
<tr>
<td align="center" style="font-size: small; padding-bottom: 1em;">
Külföldre történő szállítás esetén a kiszállítási díjat a Vevő fizeti. A kiszállítási díj a termékekkel együtt kerül kiszámlázásra.
</td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="800" height="80">
</td>
<td> </td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="1000" style="background-color:#e8e8e8; text-align:center;">
<table width="1000" cellpadding="0" cellspacing="0" border="0" style="font-size: 14px; font-family: Arial; text-align:center; table-layout:fixed;">
<tr>
<td> </td>
<td width="800" height="30"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="800" height="20" valign="top" style="line-height:10px; border-bottom:1px solid #ccc;">
<h2 style='font-size:18px; font-weight:normal; color:#f36f21;'>i-Cell Kft.
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="800" height="28" valign="bottom" style="line-height:22px;">
<b>Cím:</b> 1143 Budapest Hungária köz 5. <b style='margin-left:20px'>E-mail: </b>info#icell.hu <b style='margin-left:20px'>Tel.:</b> +36 (1) 467 1750
<td> </td>
</tr>
<tr>
<td> </td>
<td width="800" height="100">
<img src="http://icell.hu/mail/lablec.png" alt="i-Cell" width="800px">
</td>
<td> </td>
</tr>
<tr>
<td height="25"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="1000" height="65" valign="bottom" style="text-align:center; font-size:11px; line-height:15px; color:#404040;">
Ez az e-mail az i-Cell Kft. rendszeréből lett kiküldve.<br>
A rendszerben lévő adatokat bizalmasan kezeljük, harmadik fél számára nem adjuk ki.
</td>
<td> </td>
</tr>
<tr>
<td height="55"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
So I've managed to solve this. Thing what finally worked is:
add_filter( 'wp_mail_content_type', function () { return 'text/html'; } );
try { wp_mail($to, $subject, $this->getResult()); }
catch (Exception $e) { $result = false; }
You need to remove following lines as remove filter also gets registered on the go.
remove_filter( 'wp_mail_content_type', 'set_html_content_type' );
I would like to know if there exists a technique to make the text set at the same line or at the same level because what I did is to add a line-height for my two first blocks but if I add a line-height for the others there is still a difference. It creates a weird look because my titles are not the same in each cell.
$(document).ready(function() {
$(".toggler").click(function(e) {
e.preventDefault();
$(this).closest('table').find('[class^="cat"]').toggle();
});
});
a {
color: #002642;
}
.center {
text-align: center;
}
.toggler,
.cat1 {
font-family: 'Varela Round';
color: white;
}
td {
display: block;
width: auto;
border: 1px dotted #c4a77d;
background-color: #c4a77d;
color: white;
margin-bottom: 10px;
}
#media only screen and (min-width: 70em) {
td {
display: table-cell;
border: 1px dotted #c4a77d;
background-color: #c4a77d;
color: white;
margin-bottom: 0px;
}
}
p {
font-family: 'Varela Round';
font-weight: bold;
text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table style="table-layout: fixed; width:100%" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table width="100%" class="center">
<tr>
<td style="line-height:100px;">
<p style="vertical-align:middle;">SOCIÉTÉS: 230</p>
</td>
</tr>
<tr>
<td>+ En savoir plus</td>
</tr>
<tr class="cat1" style="display:none">
<td>Part CAC 40 : 90</td>
</tr>
<tr class="cat1" style="display:none">
<td>Part Filiales +100M€: 120</td>
</tr>
</table>
</td>
<td>
<table width="100%" class="center">
<tr>
<td style="line-height:100px;">
<p style="vertical-align:middle;">CONTACTS : 16 700</p>
</td>
</tr>
<tr>
<td>+ En savoir plus</td>
</tr>
<tr class="cat1" style="display:none">
<td>Part CAC 40 : 10 000 </td>
</tr>
<tr class="cat1" style="display:none">
<td>Part Filiales +100M€: 6 700</td>
</tr>
<tr class="cat1" style="display:none">
<td>% contacts IT: 21%</td>
</tr>
</table>
</td>
<td>
<p>EMAIL NOMINATIFS: 16 700</p>
</td>
<td>
<p>OPT OUT: 3%</p>
</td>
<td>
<p>LIGNES DIRECTES: 35%</p>
</td>
</tr>
</tbody>
</table>
All you need is vertical-align:baseline on the table cells. td elements have vertical-align:middle by default.
$(document).ready(function() {
$(".toggler").click(function(e) {
e.preventDefault();
$(this).closest('table').find('[class^="cat"]').toggle();
});
});
a {
color: #002642;
}
.center {
text-align: center;
}
.toggler,
.cat1 {
font-family: 'Varela Round';
color: white;
}
td {
display: block;
width: auto;
border: 1px dotted #c4a77d;
background-color: #c4a77d;
color: white;
margin-bottom: 10px;
vertical-align:baseline;
}
#media only screen and (min-width: 70em) {
td {
display: table-cell;
border: 1px dotted #c4a77d;
background-color: #c4a77d;
color: white;
margin-bottom: 0px;
}
}
p {
font-family: 'Varela Round';
font-weight: bold;
text-align: center;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table style="table-layout: fixed; width:100%" width="100%" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td>
<table width="100%" class="center">
<tr>
<td style="line-height:100px;">
<p style="vertical-align:middle;">SOCIÉTÉS: 230</p>
</td>
</tr>
<tr>
<td>+ En savoir plus</td>
</tr>
<tr class="cat1" style="display:none">
<td>Part CAC 40 : 90</td>
</tr>
<tr class="cat1" style="display:none">
<td>Part Filiales +100M€: 120</td>
</tr>
</table>
</td>
<td>
<table width="100%" class="center">
<tr>
<td style="line-height:100px;">
<p style="vertical-align:middle;">CONTACTS : 16 700</p>
</td>
</tr>
<tr>
<td>+ En savoir plus</td>
</tr>
<tr class="cat1" style="display:none">
<td>Part CAC 40 : 10 000 </td>
</tr>
<tr class="cat1" style="display:none">
<td>Part Filiales +100M€: 6 700</td>
</tr>
<tr class="cat1" style="display:none">
<td>% contacts IT: 21%</td>
</tr>
</table>
</td>
<td>
<p>EMAIL NOMINATIFS: 16 700</p>
</td>
<td>
<p>OPT OUT: 3%</p>
</td>
<td>
<p>LIGNES DIRECTES: 35%</p>
</td>
</tr>
</tbody>
</table>
How can I troubleshoot this Outlook HTML email issue?It's displaying large gaps between in between my tables and tds
My code:
<table style="table-layout: fixed;" class="w410" width="410" align="center" cellpadding="0" cellspacing="0" border="0">
<tr style="border-collapse:collapse;" >
<td class="main-event" height="39" valign="top" align="center" colspan="" style="font-family:'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;border-collapse:collapse; mso-table-lspace:0;mso-tablerspace:0;" >
<p align="center" style="margin-bottom: 1em"><span id="exhibitors" style="font-family:'Myriad Pro', Verdana, Georgia; font-size:30px; line-height: 30px; font-style:bold; color:#0054a4; text-decoration: none !important; "><strong>65 Exhibitors<br />
Already Signed Up <br />
and Counting........</strong></span><br />
</td>
</tr>
<tr style="border-collapse:collapse;" >
<td class="main-event" height="20" valign="top" align="center" colspan="" style="font-family:'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;border-collapse:collapse;padding:0 0 0 0; mso-table-lspace:0;mso-tablerspace:0;" >
<u>Click Here For The Exhibitor List</u>
</p>
</td>
</tr>
</table>
<table style="table-layout: fixed;" class="w410" width="410" align="center" cellpadding="0" cellspacing="0" border="0">
<tr style="border-collapse:collapse;" >
<td valign="top" align="center" style="font-family:'HelveticaNeue-Light', 'Helvetica Neue Light', 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;border-collapse:collapse; padding:0 0 0 0; mso-table-lspace:0;mso-tablerspace:0;" ><img src="http://www" "alt="Register Now;" border="0" width="269" align="center" style="outline-style:none;text-decoration:none;display:block;"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td></tr>
</table>
</td>
</tr>
</table>
This is a bit of a mess isn't it?
Email HTML is not normal HTML, see (for instance):
http://templates.mailchimp.com
You can simply use border-collapse:
table { /* Will apply to all tables */
border-spacing: 0;
/* OR border-collapse: collapse; */
}
Or in your html
<table cellspacing="0">
Hope that helps
I have structure as follows in fiddle.
HTML
<table width="100%" border="0" cellspacing="0" cellpadding="20" style="width:100%;">
<tbody>
<tr style="text-align:justify;">
<td valign="top"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;">Hello,</span></font>
<br><br>
<font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;">Following contact form has been submitted.</span></font>
<div>
<font face="Arial,sans-serif!important" size="1">
<span style="font-size:13px;">
<div style="margin-top:5px;"> </div>
<table width="100%" border="0" cellspacing="0" cellpadding="2" style="width:100%;">
<tbody>
<tr>
<td align="left" valign="top" style="width:17%;text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;"><b>Name :</b></span></font></td>
<td align="left" valign="top" style="width:83%;text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;">pratik </span></font></td>
</tr>
<tr>
<td align="left" valign="top" style="text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;"><b>Email :</b></span></font></td>
<td align="left" valign="top" style="text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1"><span style="font-size:12px;">p#d.com</span></font></td>
</tr>
<tr>
<td align="left" valign="top" style="text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;"><b>Phone :</b></span></font></td>
<td align="left" valign="top" style="text-align:justify;"><font size="1"><span style="font-size:12px;">8</span></font></td>
</tr>
<tr>
<td align="left" valign="top" style="text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;"><b>Name of Facility:</b></span></font></td>
<td align="left" valign="top" style="text-align:justify;"><font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;">wee</span></font></td>
</tr>
</tbody>
</table>
</span>
</font>
</div>
</td>
</tr>
<tr style="text-align:justify;">
<td valign="top">
<font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;">Thank you,</span></font>
<br>
<font face="Arial,Helvetica,sans-serif" size="1" color="#333333"><span style="font-size:12px;">Admin</span></font>
</td>
</tr>
</tbody>
</table>
So I want to keep all alignment as it is Just move "Thank you,
Admin" Section to little top
I am working on Email Template,So inline CSS
you have cell-padding table attribute, change it to 0 then design your table by css
I think this is what you need
<table width="100%" border="0" cellspacing="0" style="width:100%;padding-left:20px;">
DEMO: http://jsfiddle.net/MX9TF/3/
remove some of your empty div, and br by cleaning up the markup .
http://jsfiddle.net/MX9TF/8/
<table>
<tbody>
<tr>
<td>
<p>Hello,
<br/>Following contact form has been submitted.</p>
<table>
<tbody>
<tr>
<th>Name :</th>
<td>pratik</td>
</tr>
<tr>
<th>Email :</th>
<td>p#d.com
</td>
</tr>
<tr>
<th>Phone :</th>
<td>8</td>
</tr>
<tr>
<th>Name of Facility:</th>
<td>awee</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<p>Thank you,
<br/>Admin</p>
</td>
</tr>
</tbody>
</table>
table {
font-family:"Arial,Helvetica,sans-serif";
font-size:12px;
color:#333;
width:100%;
text-align:justify;
}
table table th {
width:17%;
font-weight:bold;
}
Then you can tune and style your tables from style sheet with plain CSS.
:)
<td style="padding-top: 1px" valign="top">
Also, you could have mentioned in the question that css is not allowed, so that we wont think that way
One more thing worth mentioning. You could figure this with some development tools such as Firebug in Firefox. eg, open your html code in a browser, use firebug inspect to select your block, and it shows you have big space over your final td. You can also try to edit in on runtime using the firebug tool. It is a firefox plugin. If you don't have firefox, other browsers too have similar development tools
The quick answer is to remove the cellpadding="20" from your parent table and use padding or <br> on each cell instead. The cellpadding and cellspacing should only be used for zero-ing out as they do not render consistently in all clients.
There are also a whole bunch of little things you don't need in your code. Here is how it should look - this will work 100% in all email clients:
<table width="100%" border="0" cellspacing="0" cellpadding="0" style="width:100%;">
<tr>
<td valign="top" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:30px;">
Hello,
<br><br>
Following contact form has been submitted.
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="17%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
<b>Name:</b>
</td>
<td valign="top" width="83%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
pratik
</td>
</tr>
<tr>
<td valign="top" width="17%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
<b>Email:</b>
</td>
<td valign="top" width="83%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
p#d.com
</td>
</tr>
<tr>
<td valign="top" width="17%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
<b>Phone:</b>
</td>
<td valign="top" width="83%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
#
</td>
</tr>
<tr>
<td valign="top" width="17%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
<b>Name of Facility:</b>
</td>
<td valign="top" width="83%" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-bottom:10px;">
...
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #333333; padding-top:10px;">
Thank you,<br>
Admin
</td>
</tr>
</table>