Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
In this level...
Power Moves
HTML and CSS
Media queries
Signature Move
Using external resources
Front-end Foundations
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Email Base</title>
<meta name="viewport" content="width=device-width" />
</head>
<body style="margin: 0; padding: 0;">
<!-- Content -->
Journey Into Mobile
</body>
</html>
Email clients
Web-based
Email Client
Native
Website
HTML
Rendering Engine
Browser
Rendering Engine
Email Client
Email
HTML
Preprocessor
Power Moves
Removes or changes HTML tags
Removes or changes CSS
Overrides styles with app CSS
Changes the entire document structure
Signature Move
Removes all JavaScript
Power Moves
Removes any <link> tags
Overrides styles with app CSS
Changes the entire document structure
Signature Move
Removes <style> tags
Email content
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Email Base</title>
<meta name="viewport" content="width=device-width" />
</head>
<body style="margin: 0; padding: 0;">
<img src="http://example.org/images/stars.png"/>
</body>
</html>
Email content
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>HTML Email Base</title>
<meta name="viewport" content="width=device-width" />
</head>
<body style="margin: 0; padding: 0;">
<img src="...stars.png"/>
<h1>Lucha Libre!</h1>
<p>Experience 3 Bone-Crushing Hours</p>
</body>
</html>
Code examples
To focus on specific code, well use to represent additional code that isnt shown.
email.html
Opening HTML
Closing HTML
...
<body style="margin: 0; padding: 0;">
<img src="...stars.png"/>
<h1>Lucha Libre!</h1>
<p>Experience 3 Bone-Crushing Hours</p>
</body>
...
...
<body style="margin: 0; padding: 0;">
<img src="...stars.png"/>
<h1>Lucha Libre!</h1>
<p>Experience 3 Bone-Crushing Hours</p>
...
Gmails preprocessor
Text styles are different
Our code
Styling the H1
email.html
...
<h1 style="
color: #7fcce9;
font-family: 'Arial Black';
font-size: 74px;
line-height: 74px;
margin: 0;
text-transform: uppercase;">
Lucha Libre!</h1>
...
Reset styles are included inline
Adding a container
email.html
...
<div style="
margin: 0 auto;
max-width: 600px;">
<img ... >
<h1 ... >
<p ... >
</div>
...
The content is contained and the container is centered
Adding a background
email.html
...
<div style="
background-color: #211f31;
background-image: url('...bgtexture.png');">
<div ... >
<img ... >
<h1 ... >
<p ... >
</div>
</div>
...
Word
2003
2013
Width is incorrect
Padding is missing
Height
Display
Float
Position
Width
Padding
Outlook 2007-2013
Note: Prior to the creation of CSS, HTML <table> elements were o!en used
as a method for page layout. This usage has been discouraged since HTML 4,
and the <table> element should not be used for layout purposes.
- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/table
<table>
<tr>
<td>Rank</td>
No default type or background colors
<tr>
...
2px cellspacing
No extra spacing
<table border="0"
cellpadding="0"
cellspacing="0">
<tr>
<td>Rank</td>
...
2px cellspacing
1 table
3 rows, each with 1 cell
Instead of <p>
...
Table is centered
Adding a background
Use a wrapper table around the content with the background.
email.html
...
<body ... >
<table ...
style="
background-color: #211f31;
background-image: url('bgtexture.png');"
width="100%" >
<tr>
<td>
<table ... >
...
</td>
</tr>
Our
content
table
with
3
rows
</table>
</body>
...
Level 2 - Section 2
Table
Table
Table
Table
Table
...
Header content table
<table ... >
<table ... >
<table align="center"
border="0"
cellpadding="0"
cellspacing="0"
width="600">
<tr>
<td>
<img src="...luchadors.png"
style="display: block;
max-width: 100%;"
width="600" />
</td>
</tr>
</table>
...
Margin
Outlook.com
content table
<tr>
<td style="
font-family: Arial;
font-size: 30px;
font-weight: bold;
line-height: 30px;
padding-bottom: 20px;
padding-top: 5px;">
de Junio
</td>
</tr>
<tr>
<td>
<table align="center"
...
width="236">
<tr>
<td height="4">
</td>
</tr>
<tr>
<td bgcolor="#fcfbfd"
height="3">
</td>
</tr>
</table>
</td>
</tr>
320px container
600px table triggers zoom to fit
email.html
...
<style>
@media screen and (max-width: 600px) {
.width-full {
width: 100% !important; } }
</style>
...
10px spacing
We want the 2
cells to stack
Forces 0 padding
Adds 20px
2010
email.html
...
<!--[if gte mso 12 && lt mso 15]>
<style>
.email-slogan {
font-size: 24px !important;
line-height: 24px !important; }
</style>
<![endif]-->
...
2007
2010
email.html
....
<!--[if gte mso 12]>
<style>
td {
mso-line-height-rule: exactly; }
</style>
<![endif]-->
...
Vendor property
This property is only consistent when
applied to table elements.
2010
email.html
....
<!--[if gte mso 12]>
<style>
...
.email-title {
padding-bottom: 0 !important; }
</style>
<![endif]-->
...
<td style="...
font-size: 14px;
line-height: 14px;">
<span class="email-tickets-category"
style="...
font-size: 28px;
line-height: 28px;">
Adults</span>
<span class="email-tickets-price"
style="...
font-size: 32px;
line-height: 32px;">
15</span>
pesos
</td>
2013
email.html
...
<tr>
<td height="4"
If the cell is empty
style="font-size: 4px;
line-height: 4px;">
</td>
Adding
a
non-breaking
space
</tr>
fixes
the
layout
issue
<tr>
<td bgcolor="#fcfbfd"
height="3"
style="font-size: 3px;
If the cell has
line-height: 3px;">
anything
in
it
</td>
Adding a non-breaking space
</tr>
fixes the layout issue
...
2013
2013
email.html
...
<td style="font-size: 18px;
line-height: 18px;">
<img ... />
</td>
...
<td style="font-size: 18px;
line-height: 18px;">
<img ... />
</td>
...
2013
Level 4 - Section 2
Adding a button
The necessary properties to style a button are not supported by the Word preprocessor.
email.html
...
<td style="padding-top: 30px;">
<a href="http://example.org"
style="background-color: #886cac;
border: 2px solid #000000;
border-radius: 6px;
color: #ffffff;
display: block;
font-family: Arial, sans-serif;
font-size: 20px;
font-weight: bold;
line-height: 250%;
text-decoration: none;
text-transform: uppercase;
width: 260px;">
Buy Tickets</a>
Padding is missing
...
Try VML
Vector Markup Language
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:w="urn:schemas-microsoft-com:office:word">
If Microsoft Office,
use VML and HTML
Consistent appearance!
Level 4 - Section 3
New table
3 rows
1 cell in each row
No link
Link
Zoomed out
Avoiding zoom
Elements must use a width that fits within the viewport or a max-width to contain them.
email.html
...
<table ... style="margin: 0 auto;
max-width: 600px;
text-align: center;
width="100%">
...
Width is flexible
up to 600px
No more zoom!
320px viewport
300px table
300px table
...
<style>
@media screen and (max-width: 600px) {
...
.width-full { width: 100% !important;}
.stack-column-two { padding-top: 20px !important;}
... }
</style>
...
<table align="left".class="width-full" width="300" ... >
...
</table>
<table align="left" class="width-full" width="300" ... >
<tr>
<td class="stack-column-two">
...
...
Viewport is 375px
...
<table align="left".width="300" ... >
...
<table bgcolor="#5b3885" width="100%" ... >
...
<table align="left" width="300" ... >
...
<table bgcolor="#0089b4" width="100%" ... >
...
...
email.html
...
<table ... style="...
Margin: 0 auto;>
...
2013
2003
2013
2013
...
<td style="font-size: 0;">
<div style="display: inline-block;">
<table align="left" width="300" ... >
...
</div>
<div style="display: inline-block;">
<table align="left" width="300" ... >
...
</div>
</td>
...