I'm trying to include in my doxygen documentation (html) a drawing representing the structure of a packet, something similar to the following example:
I know diagrams can be generated from code using several commands (e.g. #startuml/#enduml, #dot/#enddot, #msc/#endmsc), but looking at various usage examples I wasn't able to find a proper way of doing it.
Does anyone know how I can achieve a similar result without having to include an external resource, such as image or diagram file (using one of the commands above, or others if needed)?
Thanks in advance.
Following albert suggestions, a HTML table seems the reasonable tool to achieve the result I was looking for.
Here is my attempt:
<table style="border: none; border-collapse: collapse; margin-left:auto; margin-right:auto; table-layout: fixed; width: 1000px;">
<caption style="caption-side: bottom" id="Figure-1">Example of binary string: IP packet structure.</caption>
<tr>
<td>
<td style="text-align: left; font-size: 10px;" colspan="8">0
<td style="text-align: left; font-size: 10px;" colspan="8">8
<td style="text-align: left; font-size: 10px;" colspan="2">16
<td style="text-align: right; font-size: 10px;" colspan="1">18
<td style="text-align: left; font-size: 10px;" colspan="5">
<td style="text-align: left; font-size: 10px;" colspan="4">24
<td style="text-align: right; font-size: 10px;" colspan="4">31
<tr>
<td text-align="center" vertical-align="middle">1
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="4">Version
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="4">Header Length
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="8">Type of Service
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="16">Total Length
<tr>
<td text-align="center" vertical-align="middle">2
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="16">Identification
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="3">Flags
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="13">Fragment Offset
<tr>
<td text-align="center" vertical-align="middle">3
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="8">Time To Live
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="8">Protocol
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="16">Header Checksum
<tr>
<td text-align="center" vertical-align="middle">4
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="32">Source IP Address
<tr>
<td text-align="center" vertical-align="middle">5
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="32">Destination IP Address
<tr>
<td text-align="center" vertical-align="middle">6
<td style="border: 2px solid black; border-collapse: collapse; text-align: center;" colspan="32" rowspan="3">Options
<tr>
<td text-align="center" vertical-align="middle">7
<tr>
<td text-align="center" vertical-align="middle">8
</table>
Any other suggestion will be much appreciated.
Related
I have a pretty simple unordered list with some links in an html email that generated by a server. It looks and works as expected in most email clients (gmail, apple mail, outlook web), but in Outlook desktop some of the links don't work, seemingly at random.
Specifically, some of the links (all from the same list) work, some don't. When they don't, they don't appear as links: they're not underlined and the cursor doesn't change when you mouse over them.
Here's the code:
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>New Lead</title>
<style>
#media only screen and (max-width: 620px) {
table[class=body] h1 {
font-size: 28px !important;
margin-bottom: 10px !important;
}
table[class=body] h2 {
margin-bottom: 5px !important;
}
table[class=body] p,
table[class=body] ul,
table[class=body] ol,
table[class=body] td,
table[class=body] span,
table[class=body] a {
font-size: 16px !important;
}
table[class=body] .wrapper,
table[class=body] .article {
padding: 10px !important;
}
table[class=body] .content {
padding: 0 !important;
}
table[class=body] .container {
padding: 0 !important;
width: 100% !important;
}
table[class=body] .main {
border-left-width: 0 !important;
border-radius: 0 !important;
border-right-width: 0 !important;
}
table[class=body] .btn table {
width: 100% !important;
}
table[class=body] .btn a {
width: 100% !important;
}
table[class=body] .img-responsive {
height: auto !important;
max-width: 100% !important;
width: auto !important;
}
}
#media all {
.btn-primary table td:hover {
background-color: #229422 !important;
}
.btn-primary a:hover {
background-color: #229422 !important;
border-color: #229422 !important;
}
.statusLinks a {
color: #870a0a
}
}
</style>
</head>
<body class="" style="background-color: #f6f6f6; font-family: sans-serif; -webkit-font-smoothing: antialiased; font-size: 14px; line-height: 1.4; margin: 0; padding: 0; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;">
<span class="preheader" style="color: transparent; display: none; height: 0; max-height: 0; max-width: 0; opacity: 0; overflow: hidden; mso-hide: all; visibility: hidden; width: 0;">New lead from Bill Jones of Jason Test 20220511 B</span>
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="body" style="margin-top: 20px; border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f6f6f6; width: 100%;" width="100%" bgcolor="#f6f6f6">
<tr>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top"> </td>
<td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; max-width: 580px; padding: 10px; width: 580px; margin: 0 auto;" width="580" valign="top">
<div class="content" style="box-sizing: border-box; display: block; margin: 0 auto; max-width: 580px; padding: 10px;">
<!-- START CENTERED WHITE CONTAINER -->
<table role="presentation" class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background: #ffffff; border-radius: 3px; width: 100%;" width="100%">
<!-- START MAIN CONTENT AREA -->
<tr>
<td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px;" valign="top">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
<tr>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top">
<img src="http://company.com/logo.png" alt="company logo" width="227" height="31" border="0" style="-ms-interpolation-mode: bicubic; max-width: 100%; padding-bottom: 2em; border: 0; outline: none; text-decoration: none; display: block;">
Hello,
<br/>
<br/>The following sales lead has been assigned to you based on the inquiry sender's location and needs.
<br/>
<br/>Please process the lead within 24 hours; contact the inquiry sender (when needed) and select the correct status or delegate the lead to someone else. Options are listed in the bottom of this email.
<br/>
<br/>
<h2>Lead Details</h2>
<table align="left" role="presentation" cellspacing="0" cellpadding="0" border="0" style="display:block; width: 100% !important; margin-bottom: 20px"><tbody>
<tr><td style="color: #888888; font-size: 12px;"> ID#:</td></tr>
<tr><td style="padding-left: 10px;">218271</td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;"> Source:</td></tr>
<tr><td style="padding-left: 10px;">Manually-added lead - Outbound Calls</td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;"> Status:</td></tr>
<tr><td style="padding-left: 10px;">Awaiting Sales Action</td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;">Generated Date:</td></tr>
<tr><td style="padding-left: 10px;">12 May 2022</td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;">Company:</td></tr>
<tr><td style="padding-left: 10px;">Jason Test 20220511 B</td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;">Location:</td></tr>
<tr>
<td style="padding-left: 10px;">
United States
</td>
</tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;">Contact:</td></tr>
<tr><td style="padding-left: 10px;"><div><div style="margin: .3em 0"><span style="margin-right: .25em; border: 1px solid #ccc;padding:.25em">Bill</span> <span style="border: 1px solid #ccc;padding:.25em">Jones</span></div></div><div>jason#company.com</div><div>Marketing Allowed: No</div></td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;">Interest:</td></tr>
<tr><td style="padding-left: 10px;">Training</td></tr>
<tr><td style="color: #888888; font-size: 12px; padding-top: 10px;">Customer Comment:</td></tr>
<tr><td style="padding-left: 10px;">
--
</td></tr>
</tbody></table>
<table role="presentation" style="border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background: #F7ACAD; border-radius: 3px; width: 100%;" width="100%">
<tr>
<td style="padding:10pt">
<h2 style="margin-top:0">Update Lead Status</h2>
<p>Please process this as soon as possible and select one of the options below. For detailed information of the categories, please review your Sales Handbook.</p>
<ul class="statusLinks">
<li>Qualify</li>
<li>Mark as Non-Sales Inquiry</li>
<li>Work-In-Progress</li>
<li>Mark as Disqualified</li>
<li>Mark as Junk / Solitication</li>
<li>Send to Dealer</li>
<li>Mark as Career / Media / PR / Sponsorship / Supplier Inquiry</li>
<li>Delegate to Someone Else</li>
</ul>
</td>
</tr>
</table>
</td>
</tr>
</table>
<hr style="clear: both; border: 0; border-bottom: 1px solid #cacaca; margin: 20px 0;">
<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; margin-bottom: 15px;">Your feedback is always appreciated.</p>
</td>
</tr>
<!-- END MAIN CONTENT AREA -->
</table>
<!-- END CENTERED WHITE CONTAINER -->
<!-- START FOOTER -->
<div class="footer" style="clear: both; margin-top: 10px; text-align: center; width: 100%;">
<table role="presentation" border="0" cellpadding="0" cellspacing="0" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" width="100%">
<tr>
<td class="content-block" style="font-family: sans-serif; vertical-align: top; padding-bottom: 10px; padding-top: 10px; color: #999999; font-size: 12px; text-align: center;" valign="top" align="center">
©2022 product, a product of Company.
</td>
</tr>
</table>
</div>
<!-- END FOOTER -->
</div>
</td>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top"> </td>
</tr>
</table>
</body>
</html>
Some relevant details:
The email uses the Cerberus html template.
There are no list specific styles in play outside of changing text color (no positioning or z-index stuff, etc.)
I can't replicate it myself at all; my user can't replicate it on demand either, but sees the problem routinely.
As far as I can tell the user is using the most up to date version of outlook desktop with no plugins.
Questions
Is anyone else seeing this problem?
Are there any obvious problems with my markup?
Are there any ways to lint/validate html emails for outlook standards?
Updates:
20220513 Stabbing around in the dark, I noticed if you change the zoom in the separate message window some of the links no longer work. They still look like links, but the hover and click actions no longer work. This might be related.
20220513 With some more messing around, when viewing the message in the separate, just scrolling up and down changes whether or not the links work. This has got to be some kind of outlook bug.
I have email template with simple css. I send email to user but it show css code to user and template is not working correctly.
I test by sent email to myself on Gmail It work correctly.
and problem is I don't have enough data what kind of email client that they use.
If it possible I want to avoid using email with text only.
First image is what user get.
Second image is what I test and got on gmail
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<style type="text/css">
#media screen {
#font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 400;
src: local('Lato Regular'), local('Lato-Regular'), url(https://fonts.gstatic.com/s/lato/v11/qIIYRU-oROkIk8vfvxw6QvesZW2xOQ-xsNqO47m55DA.woff) format('woff');
}
#font-face {
font-family: 'Lato';
font-style: normal;
font-weight: 700;
src: local('Lato Bold'), local('Lato-Bold'), url(https://fonts.gstatic.com/s/lato/v11/qdgUG4U09HnJwhYI-uK18wLUuEpTyoUstqEm5AMlJo4.woff) format('woff');
}
#font-face {
font-family: 'Lato';
font-style: italic;
font-weight: 400;
src: local('Lato Italic'), local('Lato-Italic'), url(https://fonts.gstatic.com/s/lato/v11/RYyZNoeFgb0l7W3Vu1aSWOvvDin1pK8aKteLpeZ5c0A.woff) format('woff');
}
#font-face {
font-family: 'Lato';
font-style: italic;
font-weight: 700;
src: local('Lato Bold Italic'), local('Lato-BoldItalic'), url(https://fonts.gstatic.com/s/lato/v11/HkF_qI1x_noxlxhrhMQYELO3LdcAZYWl9Si6vvxL-qU.woff) format('woff');
}
}
/* CLIENT-SPECIFIC STYLES */
body,
table,
td,
a {
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
table,
td {
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}
img {
-ms-interpolation-mode: bicubic;
}
/* RESET STYLES */
img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
}
table {
border-collapse: collapse !important;
}
body {
height: 100% !important;
margin: 0 !important;
padding: 0 !important;
width: 100% !important;
}
/* iOS BLUE LINKS */
a[x-apple-data-detectors] {
color: inherit !important;
text-decoration: none !important;
font-size: inherit !important;
font-family: inherit !important;
font-weight: inherit !important;
line-height: inherit !important;
}
/* MOBILE STYLES */
#media screen and (max-width:600px) {
h1 {
font-size: 32px !important;
line-height: 32px !important;
}
}
/* ANDROID CENTER FIX */
div[style*="margin: 16px 0;"] {
margin: 0 !important;
}
</style>
</head>
<body style="background-color: #f4f4f4; margin: 0 !important; padding: 0 !important;">
<div style="display: none; font-size: 1px; color: #fefefe; line-height: 1px; font-family: 'Lato', Helvetica, Arial, sans-serif; max-height: 0px; max-width: 0px; opacity: 0; overflow: hidden;"> We're thrilled to have you here! Get ready to dive into your new account. </div>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td bgcolor="#2194F4" align="center">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td align="center" valign="top" style="padding: 40px 10px 40px 10px;"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#2194F4" align="center" style="padding: 0px 10px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="center" valign="top" style="padding: 40px 20px 20px 20px; border-radius: 4px 4px 0px 0px; color: #111111; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 48px; font-weight: 400; letter-spacing: 4px; line-height: 48px;">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#f4f4f4" align="center" style="padding: 0px 10px 0px 10px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 20px 30px 40px 30px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">We're excited to have you get started. First, you need to confirm your account. Just press the button below.</p>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 30px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="padding-right:10px;border-radius: 3px;" bgcolor="#2194F4">
Confirm Contract
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#ffffff" align="center" style="padding: 20px 30px 60px 30px;">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="padding-right:10px;border-radius: 3px;" bgcolor="#65F489">
View Contract
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#ffffff" align="left" style="padding: 0px 30px 40px 30px; border-radius: 0px 0px 4px 4px; color: #666666; font-family: 'Lato', Helvetica, Arial, sans-serif; font-size: 18px; font-weight: 400; line-height: 25px;">
<p style="margin: 0;">Cheers,<br> Team</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
When you send an email like this you will want a fallback. The person receiving the email can set the email up so he will see text only. You want to create a multipart message. This might help you out, so both types get content. Multipart MIME Email Guide or here: How do I send a multipart email (both HTML and plain text)
It looks like you're forwarding the email - emails will get reformatted according to the native styles of the specific email application. There's very little we can do to control that. If you want to test what it will look like, you need to send to them directly. You can use something like https://putsmail.com/ if you need.
However, not sure why the #font-face declaration are showing on forward. They shouldn't be. I suggest removing them from the #media screen { ... } - you don't need that. Just have #font-face { ... } declarations on their own.
thanks for helping me first of all.
I'm trying to format this email, but the link can not be put inside the container.
I do not know what properties I can use.
In html it works very well but when I see it in a mail client it does not work
<table width="650" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolr="#005daa" width="650px" bgcolor="#ffffff">
[imagen_1]
</td>
</tr>
<tr>
<td width="650" bgcolor="#FFFFFF" style="padding-right: 30px; padding-bottom: 20px; padding-left: 30px">
<p style="margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #5c6670; text-align: left;">
[texto_1]
</p><br>
<p style="margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #ed1b24; text-align: left; font-weight: bold">
<a style="text-decoration:none; margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #ed1b24; text-align: left; font-weight: bold"
href="https://{{ $_SERVER['HTTP_HOST'] }}/validating-email/{{$data->token}}">
CLICK HERE IN THE FOLLOWING LINK <br>TO CONFIRM YOUR MAIL
</a>
</p>
<p style="margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #ed1b24; text-align: left; font-weight: bold">
and start enjoying great benefits.
</p>
</td>
</tr>
<tr>
<td>
<table width="550" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolr="#005daa" width="650px" bgcolor="#ffffff">
<a rel="nofollow" style="widh: 500px; word-break: break-all;">
https://dominio.com/confirm-email/eyJpdiI6IkhkWlp6NlVQSXcrd0R6WnVWXC9za1wvUT09IiwidmFsdWUiOiJ3WUwycEt5UFwvbU9IVnBnWDJYejNlem1MYytHcFhMSk56OFwvOGZUdmVhYzdRbUgyNEM5b0VkMlhkdlBFNGxrcGQiLCJtYWMiOiI4MmZkNjllZjI3MTNhMDhiNTU1NmRmZjhmNmFiNzljYWM3ZGY0N2UzZTFlZjA5MjlkNmY4MDc5NWY1OGYwMWRjIn0=
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
So it looks in the emails
I already try a thousand things and not one works.
you have some idea of how I can do so that the link is set and does not remain in a single line
<table width="650" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolr="#005daa" width="650px" bgcolor="#ffffff">
[imagen_1]
</td>
</tr>
<tr>
<td width="650" bgcolor="#FFFFFF" style="padding-right: 30px; padding-bottom: 20px; padding-left: 30px">
<p style="margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #5c6670; text-align: left;">
[texto_1]
</p><br>
<p style="margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #ed1b24; text-align: left; font-weight: bold">
<a style="text-decoration:none; margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #ed1b24; text-align: left; font-weight: bold"
href="https://{{ $_SERVER['HTTP_HOST'] }}/validating-email/{{$data->token}}">
CLICK HERE IN THE FOLLOWING LINK <br>TO CONFIRM YOUR MAIL
</a>
</p>
<p style="margin: 0; font-family: Arial, sans-serif; font-size: 18px; color: #ed1b24; text-align: left; font-weight: bold">
and start enjoying great benefits.
</p>
</td>
</tr>
<tr>
<td>
<table width="550" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<td bgcolr="#005daa" width="650px" bgcolor="#ffffff">
<a rel="nofollow" style="widh: 500px;">
https://dominio.com/confirm-email/eyJpdiI6IkhkWlp6NlVQSXcrd0R6WnVWXC9za1wvUT09IiwidmFsdWUiOiJ3WUwycEt5UFwvbU9IVnBnWDJYejNlem1MYytHcFhMSk56OFwvOGZUdmVhYzdRbUgyNEM5b0VkMlhkdlBFNGxrcGQiLCJtYWMiOiI4MmZkNjllZjI3MTNhMDhiNTU1NmRmZjhmNmFiNzljYWM3ZGY0N2UzZTFlZjA5MjlkNmY4MDc5NWY1OGYwMWRjIn0=
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
Are you asking how to make an href work?
This is how a basic href works:
stackoverflow.com
In your case it should look like this:
<a href="https://dominio.com/confirm-email/eyJpdiI6IkhkWlp6NlVQSXcrd0R6WnVWXC9za1wvUT09IiwidmFsdWUiOiJ3WUwycEt5UFwvbU9IVnBnWDJYejNlem1MYytHcFhMSk56OFwvOGZUdmVhYzdRbUgyNEM5b0VkMlhkdlBFNGxrcGQiLCJtYWMiOiI4MmZkNjllZjI3MTNhMDhiNTU1NmRmZjhmNmFiNzljYWM3ZGY0N2UzZTFlZjA5MjlkNmY4MDc5NWY1OGYwMWRjIn0="
target="_blank" rel="nofollow" style="widh: 500px; word-break: break-all;">CLICK HERE IN THE FOLLOWING LINK<br />
TO CONFIRM YOUR MAIL<br />
and start enjoying great benefits.</a>
Or do this if you only want the url to link to the website:
<a href="https://dominio.com/confirm-email/eyJpdiI6IkhkWlp6NlVQSXcrd0R6WnVWXC9za1wvUT09IiwidmFsdWUiOiJ3WUwycEt5UFwvbU9IVnBnWDJYejNlem1MYytHcFhMSk56OFwvOGZUdmVhYzdRbUgyNEM5b0VkMlhkdlBFNGxrcGQiLCJtYWMiOiI4MmZkNjllZjI3MTNhMDhiNTU1NmRmZjhmNmFiNzljYWM3ZGY0N2UzZTFlZjA5MjlkNmY4MDc5NWY1OGYwMWRjIn0="
target="_blank">https://dominio.com/confirm-email/eyJpdiI6IkhkWlp6NlVQSXcrd0R6WnVWXC9za1wvUT09IiwidmFsdWUiOiJ3WUwycEt5UFwvbU9IVnBnWDJYejNlem1MYytHcFhMSk56OFwvOGZUdmVhYzdRbUgyNEM5b0VkMlhkdlBFNGxrcGQiLCJtYWMiOiI4MmZkNjllZjI3MTNhMDhiNTU1NmRmZjhmNmFiNzljYWM3ZGY0N2UzZTFlZjA5MjlkNmY4MDc5NWY1OGYwMWRjIn0=</a>
All of this can be on one line. I added the breaks to make it easier to see the code.
Good luck.
I am trying to create a responsive two-column row (in a table) using media-queries for an email. Using the table align method from Mailchimp, it looks great on desktop and Android. On iPhone, the media query tells the "templatecolumnContainer" to display 100% width of the screen under 480px, but it only fills 50%. The other column container, does wrap underneath the image and stretch the width of the viewport.
Here's the media query -
#media only screen and (max-width: 480px) {
.templateColumnContainer2 {
display: block !important;
width:100% !important;
margin-left: auto !important;
margin-right: auto !important;
}
}
And here's the two columns -
<table align="center" border="0" cellpadding="0" cellspacing="0" id="templateColumns" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-collapse: collapse !important;display: inline-block !important;padding-bottom: 15px;" width="750">
<tbody>
<tr>
<td align="center" valign="top">
<table align="left" border="0" cellpadding="0" cellspacing="0" class="templateColumnContainer2" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-collapse: collapse !important;display: block !important;padding-bottom: 15px; padding-left: 15px;" width="360">
<tbody>
<tr>
<td class="leftColumnContent" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #505050; font-family: Helvetica; font-size: 14px; line-height: 21px; text-align: center;">
<img class="columnImage" src="image.jpg">
</td>
</tr>
</tbody>
</table>
<table align="right" border="0" cellpadding="0" cellspacing="0" class="templateColumnContainer2" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-collapse: collapse !important;display: block !important;padding-bottom: 15px; padding-left: 15px;" width="360">
<tbody>
<tr>
<td class="rightColumnContent" height="200" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #505050; font-family: Helvetica; font-size: 14px; line-height: 18px; text-align: left; padding-left: 15px;" valign="top">
<h3 style="color: #606060 !important; display: inline; font-family: Helvetica; font-size: 16px; font-style: normal; font-weight: bold; letter-spacing: normal; line-height: 16px; margin: 0;text-align: left;">Header</h3>
<p>Some paragraph text</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
I'd be eternally grateful if anyone can fill in whatever coding gap I'm omitting!! Thanks in advance.
This should do what you ask:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Untitled Document</title>
<style>
#media screen and (max-width: 750px) {
#templateColumns {
width: 100% !important;
}
.templateColumnContainer2 {
display: block !important;
width: 100% !important;
max-width: 100% !important;
}
}
</style>
</head>
<body width="100%" style="Margin: 0;">
<center style="width: 100%;">
<table cellspacing="0" cellpadding="0" border="0" align="center" width="750" style="margin: auto;" id="templateColumns">
<tr>
<td class="templateColumnContainer2" width="50%" valign="top">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="leftColumnContent" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #505050; font-family: Helvetica; font-size: 14px; line-height: 21px; text-align: center;">
<img class="columnImage" src="image.jpg" width="100%" height="auto">
</td>
</tr>
</table>
</td>
<td class="templateColumnContainer2" width="50%" valign="top">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="rightColumnContent" height="200" style="-webkit-text-size-adjust: 100%; -ms-text-size-adjust: 100%; mso-table-lspace: 0pt; mso-table-rspace: 0pt; color: #505050; font-family: Helvetica; font-size: 14px; line-height: 18px; text-align: left; padding-left: 15px;">
<h3 style="color: #606060 !important; font-family: Helvetica; font-size: 16px; font-style: normal; font-weight: bold; letter-spacing: normal; line-height: 16px; margin: 0;text-align: left;">Header</h3>
<p>Some paragraph text</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</body>
</html>
I'm not sure what parent HTML you have above this, but I included the <body> and <center>, and slightly rewrote the <table> markup + classes to achieve a responsive layout that stacks once the viewport dips below the <table>'s desktop width of 750px.
So I'm trying to build my first responsive email, and everything is going pretty well except for my two navigation areas. The first one, I have four buttons that I would like to rearrange from running across, to stacking two ontop of two. It worked in my initial testing, but then when I sent it through my email provider, the first two tds rendered properly (both 50%) but the two that were supposed to lay underneath were all squished up to the side. Same for the second navigation I was trying to do (except, I wanted the three to switch to 100% on top of each other)
Any suggestions on how to fix this would be greatly appreciated! Here is my code (which, is working fine here, but breaks in on all mobile when I actually send it out):
/* Stacked Top Links Navigation Pattern CSS */
#media only screen and (max-width: 400px) {
td[class="main_nav"] {
padding: 0;
}
td[class="main_nav"] td {
display: inline-block;
/*float: left;*/
padding: 0 !important;
width: 50%;
}
td[class="main_nav"] a {
display: block;
padding: 10px 0;
background: #565656;
}
td[class="main_nav"] .nav1 a,
td[class="main_nav"] .nav2 a {
border-bottom: 1px solid #777;
}
td[class="main_nav"] .nav1 a,
td[class="main_nav"] .nav3 a {
border-right: 1px solid #777;
}
}
/* Stacked Top Links Navigation Pattern CSS */
#media only screen and (max-width: 400px) {
td[class="secondary_nav"] {
padding: 0;
}
td[class="secondary_nav"] td {
display: inline-block;
/*float: left;*/
padding: 0 !important;
width: 100%;
}
td[class="secondary_nav"] a {
display: block;
padding: 10px 0;
background: #005c5b;
text-align: center;
}
td[class="secondary_nav"] .nav1 a,
td[class="secondary_nav"] .nav2 a {
border-bottom: 1px solid #fff;
}
}
<!-- BEGINNING OF NAVIGATION -->
<table cellpadding="0" cellspacing="0" bgcolor="#565656">
<tr>
<td class="main_nav" width="600" bgcolor="#565656">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#565656" style="width:100%!important">
<tr>
<td class="nav1" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 1
</td>
<td class="nav2" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 2
</td>
<td class="nav3" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 3
</td>
<td align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 4
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<!-- END OF NAVIGATION -->
<!-- BEGINNING OF SECONDARY STORY NAVIGATION -->
<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td class="secondary_nav" width="600">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#005c5b">
<tr>
<td class="nav1" width="33.33%" align="center" style="padding: 20px 10px 20px 30px; text-align:left;border-right:solid 1px #ffffff;">
Secondary nav 1
</td>
<td class="nav2" width="33.33%" align="center" style="padding: 20px 10px 20px 30px; font-family: arial,sans-serif; font-size: 11px; text-align:left;border-right:solid 1px #ffffff;">
Secondary nav 2
</td>
<td class="nav3" width="33.33%" align="center" style="padding: 20px 10px 20px 30px; font-family: arial,sans-serif; font-size: 11px; text-align:left;">
Secondary nav 3
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END OF SECONDARY STORY NAVIGATION -->
I would suggest swapping out your inline cells for aligned tables. Cells won't play nice with 50%, you always need to go just under that. In saying that, your cells will never align correctly, which you'll see in my version below.
One draw back to using aligned tables so close is that you'll need to add in ghost tables around your tables, to ensure Outlook respects the close alignment you want and doesn't add the 20px margin it requires between tables.
I only made a tweak to your original cell width, to 49% in the header CSS and then I created my aligned tables version in a new row underneath your original code, with a new main_nav_inner class inside of my wrapping table.
<!DOCTYPE HTML>
<html>
<head>
<style type="text/css">
/* Stacked Top Links Navigation Pattern CSS */
#media only screen and (max-width: 400px) {
td[class="main_nav"] {
padding: 0;
}
td[class="main_nav"] td {
display: inline-block;
/*float: left;*/
padding: 0 !important;
width: 49%;
}
td[class="main_nav2"] .main_nav_inner table {
width: 50%!important;
}
td[class="main_nav"] a {
display: block;
padding: 10px 0;
background: #565656;
}
td[class="main_nav"] .nav1 a,
td[class="main_nav"] .nav2 a,
td[class="main_nav2"] .main_nav_inner .nav1,
td[class="main_nav2"] .main_nav_inner .nav2 {
border-bottom: 1px solid #777;
}
td[class="main_nav"] .nav1 a,
td[class="main_nav"] .nav3 a,
td[class="main_nav2"] .main_nav_inner .nav1,
td[class="main_nav2"] .main_nav_inner .nav3 {
border-right: 1px solid #777;
}
}
/* Stacked Top Links Navigation Pattern CSS */
#media only screen and (max-width: 400px) {
td[class="secondary_nav"] {
padding: 0;
}
td[class="secondary_nav"] td {
display: inline-block;
/*float: left;*/
padding: 0 !important;
width: 100%;
}
td[class="secondary_nav"] a {
display: block;
padding: 10px 0;
background: #005c5b;
text-align: center;
}
td[class="secondary_nav"] .nav1 a,
td[class="secondary_nav"] .nav2 a {
border-bottom: 1px solid #fff;
}
}
</style>
</head>
<body style="min-width: 100%; padding-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; padding-right: 0px" yahoo="fix">
<!-- BEGINNING OF NAVIGATION -->
<table cellpadding="0" cellspacing="0" bgcolor="#565656" width="100%">
<tr>
<td class="main_nav" bgcolor="#565656">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#565656" style="width:100%!important">
<tr>
<td class="nav1" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 1
</td>
<td class="nav2" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 2
</td>
<td class="nav3" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 3
</td>
<td class="nav4" align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 4
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="main_nav2" bgcolor="#565656">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#565656" style="width:100%!important">
<tr>
<td class="main_nav_inner">
<!--[if gte mso 9]>
<table border="0" cellpadding="0" cellspacing="0" style="width:600px;">
<tr>
<td valign="top" style="width:150px;">
<![endif]-->
<table align="left" class="nav1" border="0" cellpadding="0" cellspacing="0" style="width:25%;">
<tr>
<td align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 1
</td>
</tr>
</table>
<!--[if gte mso 9]>
</td>
<td valign="top" style="width:150px;">
<![endif]-->
<table align="left" class="nav2" border="0" cellpadding="0" cellspacing="0" style="width:25%;">
<tr>
<td align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 2
</td>
</tr>
</table>
<!--[if gte mso 9]>
</td>
<td valign="top" style="width:150px;">
<![endif]-->
<table align="left" class="nav3" border="0" cellpadding="0" cellspacing="0" style="width:25%;">
<tr>
<td align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 3
</td>
</tr>
</table>
<!--[if gte mso 9]>
</td>
<td valign="top" style="width:150px;">
<![endif]-->
<table align="left" class="nav4" border="0" cellpadding="0" cellspacing="0" style="width:25%;">
<tr>
<td align="center" style="padding: 10px 10px; font-family: arial,sans-serif; font-size: 11px;">
Nav 4
</td>
</tr>
</table>
<!--[if gte mso 9]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
</table>
</td>
</tr>
</table>
<br/>
<!-- END OF NAVIGATION -->
<!-- BEGINNING OF SECONDARY STORY NAVIGATION -->
<table cellpadding="0" cellspacing="0" style="border-collapse:collapse;">
<tr>
<td class="secondary_nav" width="600">
<table cellpadding="0" cellspacing="0" width="100%" bgcolor="#005c5b">
<tr>
<td class="nav1" width="33.33%" align="center" style="padding: 20px 10px 20px 30px; text-align:left;border-right:solid 1px #ffffff;">
Secondary nav 1
</td>
<td class="nav2" width="33.33%" align="center" style="padding: 20px 10px 20px 30px; font-family: arial,sans-serif; font-size: 11px; text-align:left;border-right:solid 1px #ffffff;">
Secondary nav 2
</td>
<td class="nav3" width="33.33%" align="center" style="padding: 20px 10px 20px 30px; font-family: arial,sans-serif; font-size: 11px; text-align:left;">
Secondary nav 3
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- END OF SECONDARY STORY NAVIGATION -->
</body>
</html>