Skip to content

Commit

Permalink
Fix mobile email rendering, drop all paddings on vertical screens (#20)
Browse files Browse the repository at this point in the history
The style-tag was scrapping the styles block, which was misleading. Template blocks should probably wrap DOM not CSS, especially with the naming.

I also used a zero-width space, or zero byte char, instead of the space, to enable paddings on Outlook.

The vertical padding is gone, on vertical phones, since most email clients implement their padding. We cannot drop the padding completely thanks to Mail on iOS, but we increased it to match iOS and look more deliberate in Gmail.
  • Loading branch information
codingjoe authored Mar 29, 2023
1 parent ad3722c commit d146b02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions emark/templates/emark/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>{{ subject }}</title>
<style>
{% block styles %}
{% include "emark/styles.css" %}
<style>{% include "emark/styles.css" %}</style>
{% endblock styles %}
</style>
</head>
<body>
{% block preheader %}
Expand All @@ -23,7 +21,7 @@
cellspacing="0"
class="body">
<tr>
<td>&nbsp;</td>
<td class="container-padding">&#xfeff;</td>
<td class="container">
<div class="content">
<!-- START CENTERED WHITE CONTAINER -->
Expand All @@ -49,7 +47,7 @@
<!-- END CENTERED WHITE CONTAINER -->
</div>
</td>
<td>&nbsp;</td>
<td class="container-padding">&#xfeff;</td>
</tr>
</table>
</body>
Expand Down
2 changes: 1 addition & 1 deletion emark/templates/emark/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ hr {

table.body .wrapper,
table.body .article {
padding: 10px !important;
padding: 24px !important;
}

table.body .content {
Expand Down

0 comments on commit d146b02

Please sign in to comment.