Last active
March 10, 2017 21:31
-
-
Save julie-ng/805e596e814994dd12f9 to your computer and use it in GitHub Desktop.
Email Layout Calculator Template
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
<script type="javascript/template" id="js-code-template"> | |
<!-- Here is the mobile gmail first (but still works in Outlook) markup --> | |
<table width="{{ container }}" border="0" cellpadding="0" cellspacing="0" align="center"> | |
<tr> | |
<td> | |
{% _(cols).times(function(n) { %} | |
{% if (n === 0) { %} | |
<!--[if mso]><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top" width="{{ colWidths[n] }}"><![endif]--> | |
{% } %} | |
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="left" class="col" style="width: 100%; max-width: {{ colWidths[n] }}px;"> | |
<tr> | |
<td class="col-{{ n+1 }}-td" style="padding-left:{{ gutterHalf }}px; padding-right:{{ gutterHalf }}px"> | |
Column {{ n+1 }} | |
</td> | |
</tr> | |
</table> | |
{% if (n < cols-1) { %} | |
<!--[if mso]></td><td valign="top" width="{{ colWidths[n+1] }}"><![endif]--> | |
{% } %} | |
{% if (n == cols-1) { %} | |
<!--[if mso]></td></tr></table><![endif]--> | |
{% } %} | |
{% }); %} | |
</td> | |
</tr> | |
</table> | |
<!-- include this in the head of your email --> | |
<style> | |
{% _(cols).times(function(n) { %} | |
.col-{{ n+1 }}-td { | |
{% if (n===0){ %} | |
padding-left: {{ gutter }}px !important; | |
padding-right: {{ gutterHalf }}px !important; | |
{% } else if (n == cols-1) { %} | |
padding-left: {{ gutterHalf }}px !important; | |
padding-right: {{ gutter }}px !important; | |
{% } else { %} | |
padding-left: {{ gutterHalf }}px !important; | |
padding-right: {{ gutterHalf }}px !important; | |
{% } %} | |
} | |
{% }); %} | |
@media screen and (max-width: 599px) { | |
.col { | |
width: 100% !important; | |
max-width: 100% !important; | |
} | |
.col td { | |
padding-left: {{ gutterHalf }}px !important; | |
padding-right: {{ gutterHalf }}px !important; | |
} | |
} | |
</style> | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Responsive Email Grid Logic
Here you'll find the templates used in the Email Layout Calculator tool.
Version 0 (prototype)
Version 1 (28 October)