2009-08-08 6 views
0

J'essaie de créer un "certificat" à utiliser dans un projet Capmaign. Nous essayons de maintenir la compatibilité avec Outlook 2007 et cela nous empêche d'utiliser la propriété background pour charger une seule image à afficher derrière le texte. J'ai découpé mes bordures en 4 morceaux (gauche, haut, droite, bas) et les ai placés dans des colonnes et rangées étalées mais je ne peux pas les aligner correctement. Des suggestions basées sur ce code?Tables HTML utilisant des images JPG comme frontières

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Special Offer from Toyota/Scion of Clifton Park</title> 
<style type="text/css"> 
<!-- 
.style1 {font-family: Arial, Helvetica, sans-serif} 
.style2 { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: small; 
    font-style: italic; 
} 
.style4 { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 12px; 
} 
.style8 { 
    font-family: Arial, Helvetica, sans-serif; 
    font-size: 12px; 
    font-style: italic; 
    color: #666666; 
} 
.style9 {color: #666666} 
.style10 {color: #000000} 

} 
--> 
</style> 
</head> 

<body> 
<table width="610" height="984" border="0" cellspacing="0" cellpadding="0"> 
    <tr></tr> 


    <tr> 
    <td width="74" rowspan="11"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/left_image2.jpg" alt="Left Image" width="70" height="984" align="top" /></td> 
    <td colspan="5"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/top_image3.jpg" alt="Top Image" width="461" height="171" align="left" /></td> 
    <td width="87" rowspan="11"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/right_image2.jpg" border=0 alt="Right Image" width="71" height="984" align="bottom" /></td> 
</tr> 
    <tr> 
    <td colspan="5">&nbsp;</td> 
    </tr> 

    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 
    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 
    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 
    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 
    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 

    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 

    <tr> 
    <td colspan="5">&nbsp;</td> 
</tr> 

    <tr> 
    <td width="90">&nbsp;</td> 
    <td width="90">&nbsp;</td> 
    <td width="90">&nbsp;</td> 
    <td width="90">&nbsp;</td> 
    <td width="91">&nbsp;</td> 
</tr> 
    <tr> 
    <td colspan="5"><div align="center"> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4">&nbsp;</p> 
    <p class="style4"><span class="style8"><br/> 
     </span><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/bottom_image2.jpg" alt="Bottom Image" width="466" height="63" align="top" /><br /> 
    </p> 
    </div></td> 
</tr> 
</table> 

</body> 
</html> 

Répondre

0

Toutes les cellules de colonne du milieu ont des hauteurs variables (non fixes) et donc le navigateur va juste essayer de les adapter à ce qu'il pense être le mieux.

Vous devez corriger les hauteurs en utilisant l'attribut de style comme ceci:

<td style="height: 171px;"> 

Ce serait pour la cellule contenant l'image du haut que l'image a une hauteur de 171px.

Aussi: Avez-vous besoin de 9 rangées au centre? Ou avez-vous essayé cela pour positionner les frontières?

Modifier: Ou ce que Re0sless a dit. ; D

0

Vous pouvez le faire en ajoutant valign = "top" etvalign = "bottom" aux cellules du centre en haut et en bas de la table.

comme ceci:

<tr> 
    <td width="74" rowspan="11"><img src="left_image2.jpg" width="70" height="984" align="top" /></td> 
    <td colspan="5" valign="top"><img src="top_image3.jpg" width="461" height="171" align="left" /></td> 
    <td width="87" rowspan="11" ><img src="http:right_image2.jpg" border=0 width="71" height="984" align="bottom" /></td> 
</tr> 
...... 
<tr valign="bottom"> 
0

Mes suggestions:

  1. Définissez les largeurs d'image aux valeurs propres (haut et bas sont 459px de large).
  2. Définissez la largeur de la table sur la valeur totale (459 + 71 + 71 = 600).
  3. Créez une ligne distincte pour l'image du bas et placez tout votre contenu dans une cellule de tableau. Vous pouvez imbriquer plus de tables à l'intérieur si vous en avez besoin.


<table width="600" height="984" border="0" cellspacing="0" cellpadding="0"> 
    <tr> 
     <td width="74" rowspan="3"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/left_image2.jpg" alt="Left Image" width="70" height="984" align="top" /></td> 
     <td><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/top_image3.jpg" alt="Top Image" width="459" height="171" align="left" /></td> 
     <td width="71" rowspan="3"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/right_image2.jpg" border=0 alt="Right Image" width="71" height="984" align="bottom" /></td> 
    </tr> 
    <tr> 
     <td>Put all your content in here.</td> 
    </tr> 
    <tr> 
     <td valign="bottom"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/bottom_image2.jpg" alt="Bottom Image" width="459" height="63" align="top" /></td> 
    </tr> 
</table> 
0

... il y a deux façons de le fixer, l'un (si cela va fonctionner dans les perspectives et l'affichage dans tous les autres agents de courrier) serait de positionner le haut et le bas images de frontière absolument dans les cellules. Deuxièmement, je restructurerais peut-être la table. Faites en sorte que les bordures du haut et du bas recouvrent toutes les colonnes, comme si elles couvraient la table depuis le haut et le bas et le prenaient à partir de là.

0
  1. Réglez la cellule du milieu haut en haut alignement vertical: .... top_image3.jpg ....

2. Couper une nouvelle image à utiliser pour le bas qui comprend les colonnes gauche, milieu et droite de la table entière et le jeter dans une cellule avec un colspan = "7"

0

Assurez-vous que reset all your CSS de sorte que marge et padding est à 0 avant d'appliquer des styles.

1

Merci pour toutes vos suggestions - GRANDE AIDE! Voici ce que j'ai fini avec si vous êtes curieux. Les aperçus erronés dans les navigateurs s'affichent correctement dans les clients de messagerie du destinataire. J'ai testé avec succès Gmail, Outlook 2000/2007, Yahoo (ancien/nouveau), Hotmail, Thunderbird.

également trouvé ce guide CSS dans les courriels http://www.campaignmonitor.com/css/ (éviter essentiellement si l'envoi d'Outlook 2007/2010 et les clients Gmail)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
</head> 

<style type="text/css"> 
/* http://meyerweb.com/eric/tools/css/reset/ */ 
/* v1.0 | 20080212 */ 

html, body, div, span, applet, object, iframe, 
h1, h2, h3, h4, h5, h6, p, blockquote, pre, 
a, abbr, acronym, address, big, cite, code, 
del, dfn, em, font, img, ins, kbd, q, s, samp, 
small, strike, strong, sub, sup, tt, var, 
b, u, i, center, 
dl, dt, dd, ol, ul, li, 
fieldset, form, label, legend, 
table, caption, tbody, tfoot, thead, tr, th, td { 
    margin: 0; 
    padding: 0; 
    border: 0; 
    outline: 0; 
    font-size: 100%; 
    vertical-align: baseline; 
    background: #FFF; 
    text-align: left; 
} 
body { 
    line-height: 1; 
} 
ol, ul { 
    list-style: none; 
} 
blockquote, q { 
    quotes: none; 
} 
blockquote:before, blockquote:after, 
q:before, q:after { 
    content: ''; 
    content: none; 
} 

/* remember to define focus styles! */ 
:focus { 
    outline: 0; 
} 

/* remember to highlight inserts somehow! */ 
ins { 
    text-decoration: none; 
} 
del { 
    text-decoration: line-through; 
} 

/* tables still need 'cellspacing="0"' in the markup */ 
table { 
    border-collapse: collapse; 
    border-spacing: 0; 
} 
body table tr td { 
    font-family: Arial, Helvetica, sans-serif; 
} 
</style> 
<body> 
<table width="600" height="984" border="0" cellspacing="0" cellpadding="0" font-family: Arial, Helvetica, sans-serif;>  
<tr> 
<td valign="top" width="74" rowspan="3"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/left_image2.jpg" alt="Left Image" width="70" height="984" /></td> 

<td valign="top"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/top_image3.jpg" alt="Top Image" width="459" height="171" /></td> 

<td valign="top" width="71" rowspan="3"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/right_image2.jpg" border=0 alt="Right Image" width="71" height="984" /></td> 
</tr> 
<tr> 
<td> 
    <p align="center"><font size="+1"> <strong>Special Introductory Maintenance Offer for:</strong></font></p> 
    <p align="center"><em>Insert Name<br />Insert Vehicle<br />Insert Vin#<br />Insert Delivery Date</em></p> 
    <p align="center"><strong>First 5,000 Miles/6 Months <br /> Maintenance Service<br />$29.95<br /><font size="-4">(a $79.95 value)<br/><br/><font size="-1">to include:<br /></strong></p> 
    <ul> 
    <li><div align="left">Inspect and top off washer fluid, brake fluid, <br /> 
     power steering fluid, and coolant level</div></li> 
    <li><div align="left"><font size="-1">Set tire pressures and rotate tires</div></li> 
    <li><div align="left">Thorough tire inspection for abnormal wear or damage</div></li> 
    <li><div align="left">Inspect wiper blades</div></li> 
    <li><div align="left">Replace engine oil and filter</div></li> 
    <li><div align="left">Reset maintenance indicator </div></li> 
    </font> 
    </ul> 

    <p align="left"><font size="-1"><span>Toyota of Clifton Park would like to <strong>Thank You</strong> for your vehicle purchase. We have taken time in caring for and preparing your vehicle before your purchase and would like to continue that same care throughout your ownership. I personally invite you to take advantage of the above offer for your first full Toyota scheduled maintenance in our Award winning service department. The initial &quot;break in&quot; inspection is crucial to the safety and longevity of your new investment.<br /><br /> 
    Our call center will be following up with you as a reminder when the time gets close. If you have any questions or concerns please don't hesitate to call the service department at 518-664-4444. Any one of our associates can answer your questions. We truly appreciate your business and look forward to seeing you soon.</span></font></p> 

<p align="center"><span>Thank You, <br />Jason Halliday, Service Manager<br />Toyota/Scion of Clifton Park<br /><font size="-3"><em><br /><br />Certificate expires 6 months from delivery date or <br />5,000 miles, whichever comes first.<br />Applicable sales tax not included.<br />Certificate not transferable, valid only for the above customer and vehicle.<br /> NC OPCODE FSCERT<br /></em></font></span></p> 
</td>  
</tr> 
<tr> 
<td valign="bottom"><img src="http://pbrgraphics.com/Constant_Contact/TCP/cert_borders/bottom_image2.jpg" alt="Bottom Image" width="459" height="63"/></td>  
</tr> 
</table> 
</body> 
</html> 
0

Après la chasse autour de cette question pour mes propres besoins « des tableaux HTML utiliser des images comme frontières "Je suis arrivé à une solution que je n'ai pas vue ailleurs. Il utilise un fond séparé sur le corps, tr et td pour obtenir l'effet désiré. Voici le IE8 (CSS2) solution compatible:

table.table tbody { 
     background-color: #dddddd; 
} 

table.table tbody tr td, table.table thead tr th { 
    background-image: url('some-image.png'); 
    background-position: right; 
    background-repeat: repeat-y; 
} 

table.table tbody tr { 
    background-image: url('some-image.png'); 
    background-position: top; 
    background-repeat: repeat-x; 
} 

La solution dans CSS3 est d'utiliser plusieurs milieux:

table.table tbody tr td, table.table thead tr th { 
     background-image: url('some-image.png'), url('some-image.png'); 
     background-position: top, right; 
     background-repeat: repeat-x, repeat-y; 
} 

L'espoir que cela aide quelqu'un à l'avenir.

Questions connexes