Created
February 10, 2014 10:14
-
-
Save devlint/8913460 to your computer and use it in GitHub Desktop.
Email responsive notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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>A Simple Responsive HTML Email</title> | |
<style type="text/css"> | |
body {margin: 0; padding: 0; min-width: 100%!important;} | |
.content {width: 100%; max-width: 600px;} | |
</style> | |
</head> | |
<body yahoo bgcolor="#f6f8f1"> | |
<table width="100%" bgcolor="#f6f8f1" border="0" cellpadding="0" cellspacing="0"> | |
<tr> | |
<td> | |
<table class="content" align="center" cellpadding="0" cellspacing="0" border="0"> | |
<tr> | |
<td> | |
Hello! | |
</td> | |
</tr> | |
</table> | |
</td> | |
</tr> | |
</table> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***** QUELQUES ASTUCES CSS *****/ | |
/* | |
Pour cibler un TD avec une class => passer par un sélecteur | |
d'attribut pour éviter que Yahoo ne l'utilise dans la version | |
desktop ! | |
*/ | |
@media only screen and (max-device-width: 400px) { | |
td[class="maClass"]{width: 100%;} | |
} | |
/* | |
Pour afficher une image différente sur mobile (donc via les MQ) : | |
avec le code html suivant : | |
td.maClass > a > img | |
*/ | |
@media only screen and (max-device-width: 400px) { | |
td[class="maClass"] img{display: none;} /* il s'agit de l'image desktop */ | |
td[class="maClass"] a{ | |
display: block; | |
width: 320px; /* dimensions de l'image mobile */ | |
height: 2580px; /* dimensions de l'image mobile */ | |
background-image: url(../monImage.jpg); /* src de l'image mobile */ | |
} | |
} | |
/* | |
Pour corriger un bug de marges dans Outlook : surcharger les margin: 0 avec : | |
*/ | |
style="[...] mso-table-layout-lspace: 0pt;mso-table-layout-rspace: 0pt;" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment