I am working on a HTML email newsletter. I have the layout split up via various tables and inline CSS. If you visit https://heathology.github.io/email-newsletter/, you can see a live demo of my newsletter.
There is an image that says Fright Night and it is column 1 of two-columns. I would like to center the image vertically next to the content in column 2. I cannot get the image to bump down.
Below, you will see my css code:
/* two columns */
.two-columns.last {
padding: 15px 0;
}
.two-columns .padding {
padding: 20px;
}
.two-columns .content {
font-size: 15px;
line-height: 20px;
text-align: left;
}
.button {
background-color: #ffffff;
color: #171a1b;
text-decoration: none;
padding: 12px 20px;
border-radius: 5px;
font-weight: bold;
}
.button-dark {
background-color: #171a1b;
color: #ffffff;
text-decoration: none;
padding: 12px 20px;
border-radius: 5px;
font-weight: bold;
}
In the HTML below, you can see how I have arranged it via tables:
<!-- TWO COLUMN SECTION -->
<tr>
<td style="background-color: #26292b; color: #ffffff;">
<table width="100%">
<tr>
<td class="two-columns last">
<table class="column">
<tr>
<td class="padding">
<table class="content">
<tr>
<td>
<img src="img/2022-Fright-Night.png" alt="" width="260" style="max-width:260px;">
</td>
</tr>
</table>
</td>
</tr>
</table>
<table class="column">
<tr>
<td class="padding">
<table class="content">
<tr>
<td>
<p style="font-weight: bold; font-size: 18px;">Fright Night</p>
<p style="padding-bottom: 16px;">Do you like chills and fright? Then, join St. Auggies' youth at Frontier City's Fright Night on Friday, October 28 from
6:00pm-10:00pm. Tickets are $42.99/per person. Open to youth and adults 12 & up.</p>
Sign Up
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
Are there any recommendations? If need be, you can see the full code here.
change in css style for .two-columns .column
width: 100%;
max-width: 300px;
display: inline-block;
vertical-align: middle;
text-align: center;
Related
I am developing dynamic HTML templates for sending emails to clients. the template I have developed is working fine on large screens but on medium and small screens I am facing one design issue. the template supposed to be like this
it should be surrounded by light grey color and body with white color. the template I have developed is also the same but for mobiles, it is like this
As you can see the light grey color on the sides is not visible as the content occupied all the space. I need to make it visible for mobile screens as well. I have tried applying some padding and reducing width but it is not working. JSfiddle link is not taking by the stack overflow so dropping it in the comments please check it and any help is very much appreciated. [JSfiddle][3]
/* Take care of image borders and formatting, client hacks */
img {
max-width: 600px;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}
a img {
border: none;
}
table {
border-collapse: collapse !important;
}
#outlook a {
padding: 0;
}
.ReadMsgBody {
width: 100%;
}
.ExternalClass {
width: 100%;
}
.backgroundTable {
margin: 0 auto;
padding: 0;
width: 100% !important;
}
.branding {
display: inline-flex;
align-items: center;
margin-left: 1%;
}
table td {
border-collapse: collapse;
}
.ExternalClass * {
line-height: 115%;
}
.container-for-gmail-android {
min-width: 600px;
background-color: white;
}
/* General styling */
* {
font-family: Helvetica, Arial, sans-serif;
}
body {
-webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none;
width: 100% !important;
margin: 0 !important;
height: 100%;
color: #676767;
}
td {
font-family: Helvetica, Arial, sans-serif;
font-size: 14px;
color: #777777;
text-align: center;
line-height: 21px;
}
th {
padding-top: 12px;
text-align: left;
color: white;
}
.report-table {
border: 3px solid #707070;
margin-top: 20px;
}
.report-table th {
background-color: #333333;
}
.border {
border: 1px solid grey;
}
table {
border-collapse: collapse;
}
/* table [class ~= "report-table"]{
border:1px solid#007770;
} */
.marks {
display: inline-block;
color: white;
width: 50px;
text-align: center;
background-image: linear-gradient(246deg, #0080FF, #072F9C);
line-height: 2;
letter-spacing: 1.6px;
vertical-align: top;
}
.sub {
width: 210px;
display: inline-block;
max-width: 300px;
padding-left: 5px;
padding-right: 5px;
padding-top: 5px;
}
.p-logo {
width: 50px;
float: left;
}
.source {
text-align: left;
}
.white td {
color: white;
}
.attempted {
text-align: left;
}
.attempted p {
/* display: inline-block; */
margin-right: 10px;
float: left;
line-height: 1;
}
.mod-title {
text-align: left;
padding-top: 20px;
}
.mod-title,
.attempted {
padding-left: 15px;
padding-right: 15px;
}
.img {
float: right;
margin-right: 0px;
margin-top: -70px;
margin-bottom: -70px;
width: 152px;
}
.report-table td,
.report-table th {
border: 1px solid gainsboro;
padding: 5px;
text-align: center;
}
.report-table tr:nth-child(even) {
background-color: #f2f2f2;
}
/* .report-table tr:hover {background-color: #ddd;} */
.week {
background-color: gainsboro;
display: inline-block;
padding: 5px;
border-radius: 10px;
/* font-size: 20px; */
margin-bottom: 10px;
}
.weekdays {
color: #0080FF;
background-color: gainsboro;
border: 1px solid white !important;
}
.report-scores {
color: white;
}
.header-lg,
.header-md,
.header-sm {
/* font-size: 32px; */
font-size: 1.5em;
font-weight: 700;
line-height: normal;
padding: 35px 0 0;
color: #4d4d4d;
}
.sub-head {
font-size: 1.5em;
line-height: 2;
padding-bottom: 30px;
letter-spacing: 0.6px;
padding-top: 20px;
}
.header-summary td {
padding-top: 10px;
font-size: 1.6em;
letter-spacing: 1.6px;
padding-bottom: 20px;
font-weight: 600;
}
.header-md {
font-size: 24px;
}
.header-sm {
padding: 5px 0;
font-size: 18px;
line-height: 1.3;
}
.mobile-header-padding-right {
width: 290px;
text-align: right;
padding-left: 10px;
}
.mobile-header-padding-left {
width: 290px;
text-align: left;
padding-left: 10px;
}
.force-width-gmail {
min-width: 600px;
height: 0px !important;
line-height: 1px !important;
font-size: 1px !important;
}
</style><style type="text/css" media="screen">#import url(http://fonts.googleapis.com/css?family=Oxygen:400,700);
</style><style type="text/css" media="screen">#media screen {
/* Thanks Outlook 2013! */
* {
font-family: 'Oxygen', 'Helvetica Neue', 'Arial', 'sans-serif' !important;
}
}
</style><style type="text/css" media="only screen and (max-width: 480px)">
/* Mobile styles */
#media only screen and (max-width: 480px) {
.mobile-font-xl {
font-size: 30px;
}
.mobile-font-lg {
font-size: 28px;
}
.mobile-font-sm {
font-size: 24px;
}
.mobile-font-md {
font-size: 26px;
}
.img {
display: none;
}
table[class*="container-for-gmail-android"] {
min-width: 290px !important;
width: 100% !important;
}
table[class="w320"] {
width: 320px !important;
}
td[class="bottom_description"] {
font-size: 18px;
}
img[class="force-width-gmail"] {
display: none !important;
width: 0 !important;
height: 0 !important;
}
td[class*="mobile-header-padding-left"] {
width: 160px !important;
padding-left: 0 !important;
}
td[class*="mobile-header-padding-right"] {
width: 160px !important;
padding-right: 10px !important;
font-size: 18px !important;
}
td[class="info-block"] {
display: block !important;
width: 280px !important;
padding-bottom: 40px !important;
}
td[class="info-img"],
img[class="info-img"] {
width: 278px !important;
}
.week {
font-size: 20px;
}
.report-table,
.report-table td {
font-size: 18px;
}
}
</style><style type="text/css" #media="only screen and (min-width:481px) and (max-width:768px)">#media only screen and (min-width:481px) and (max-width:768px) {
td[class="bottom_description"] {
font-size: 18px;
}
td[class*="mobile-header-padding-right"] {
padding-right: 10px !important;
}
}
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Xamplay - Courses Activated</title>
</head>
<body style="background-color:#f0f0f0;">
<table align="center" cellpadding="0" cellspacing="0" width="770" class="w320">
<tr>
<td width="100%" style="text-align: left;">
<div class="branding">
<img class="p-logo" src="https://xamplay.com/assets/xamplay-logo.png">
<h1 class="source">Xamplay</h1>
</div>
</td>
</tr>
</table>
<table align="center" cellpadding="0" cellspacing="0" class="container-for-gmail-android w320" width="600">
<tr>
<td align="center" valign="top" width="100%">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320">
<tr>
<td class="header-lg mobile-font-xl" style="color:#4d4d4d;padding-top:40px;">
Hey {{ givenName }}
</td>
</tr>
<tr>
<td style="color:#4d4d4d" class="sub-head mobile-font-lg">
Here's your Weekly Performance Report.
<br> {{ courseName }}
</td>
</tr>
<tr>
<td align="left" valign="top" width="100%">
<center>
<table style="margin-bottom:30px; " width="600" class="w320 coverage-box">
<tr style="color:#4d4d4d">
<td class="mobile-font-md">Modules Studied</td>
<td class="mobile-font-md">Quiz Attempts</td>
<td class="mobile-font-md">Test Attempts</td>
</tr>
<tr class="header-summary" style="color:#4d4d4d">
<td>{{ totalModCount }}</td>
<td>{{ totalQuizCount }}</td>
<td>{{ totalTestCount }}</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</center>
</td>
</tr>
<tr>
<td align="left" valign="top" width="100%" class="content-padding">
<center>
<table align="center" cellspacing="10" cellpadding="0" width="600" class="w320 coverage-box">
<tr>
<td style="text-align: center;-webkit-text-align:center;padding:20px;" class="mobile-font-lg">
<b>startDate - endDate</b></td>
</tr>
<tr>
<td class="header-lg mobile-font-md" style="padding-bottom: 30px;padding-top: 20px;">
How much have you covered :
</td>
</tr>
<tr>
<td align="left" valign="top" width="100%">
<center>
<table style="margin-bottom:10px; " width="600" class="w320 coverage-box">
<!-- display this row for odd indexes -->
{{#each progress}} {{#if index%2==1}}
<tr style="display:inline-block;margin-bottom:20px">
<td style="text-align:left;">
<span class="sub mobile-font-md">
NATA
</span>
<span class="marks mobile-font-sm">94%</span>
</td>
</tr>
{{/if}}
<!-- display this row for even indexes -->
{{#if index%2==0}}
<tr style="float:right;width: 48%;margin-bottom:20px;">
<td style="text-align:left;">
<span class="sub mobile-font-md">
NIFT
</span>
<span class="marks mobile-font-sm">100%</span>
</td>
</tr>
{{/if}} {{/each}}
</table>
</center>
</td>
</tr>
<tr>
<td align="center" valign="top" width="100%" style="background-color: #f7f7f7; height: 100px;" class="content-padding">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320 report-table">
<tr>
<th>
<p class="mobile-font-sm">Activity</p>
</th>
<th>
<p class="mobile-font-sm">Study Modules</p>
</th>
<th>
<p class="mobile-font-sm">Quizzes</p>
</th>
<th>
<p class="mobile-font-sm">Tests</p>
</th>
<th>
<p class="mobile-font-sm">Daily Quizes</p>
</th>
</tr>
<tr>
<td class="weekdays">
<p class="mobile-font-sm">Mon</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.mon.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.mon.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.mon.test_count}}</p>
</td>
<td>
{{#each activities.mon.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
<tr class="mobile-font-sm">
<td class="weekdays mobile-font-sm">
<p class="mobile-font-sm">Tue</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.tue.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.tue.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.tue.test_count}}</p>
</td>
<td>
{{#each activities.tue.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
<tr class="mobile-font-sm">
<td class="weekdays">
<p class="mobile-font-sm">Wed</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.wed.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.wed.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.wed.test_count}}</p>
</td>
<td>
{{#each activities.wed.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
<tr>
<td class="weekdays">
<p class="mobile-font-sm">Thurs</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.thu.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.thu.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.thu.test_count}}</p>
</td>
<td>
{{#each activities.thu.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
<tr>
<td class="weekdays">
<p class="mobile-font-sm">Fri</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.fri.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.fri.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.fri.test_count}}</p>
</td>
<td>
{{#each activities.fri.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
<tr>
<td class="weekdays">
<p class="mobile-font-sm">Sat</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.sat.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.sat.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.sat.test_count}}</p>
</td>
<td>
{{#each activities.sat.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
<tr>
<td class="weekdays">
<p class="mobile-font-sm">Sun</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.sun.mod_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.sun.quiz_count}}</p>
</td>
<td>
<p class="mobile-font-sm">{{activities.sun.test_count}}</p>
</td>
<td>
{{#each activities.sun.dqs}}
<p class="mobile-font-sm">{{score}}</p>
{{/each}}
</td>
</tr>
</table>
</center>
</td>
</tr>
<tr>
<td align="left" valign="top" width="100%">
<center>
<table cellspacing="0" cellpadding="0" width="600" class="w320 " align="left">
<tr>
<td class="mod-title mobile-font-lg">
<p><b>Modules Studied</b></p>
</td>
</tr>
<tr>
<td class="attempted mobile-font-md">
{{#each activities.mon.modules}} {{_module.name}} {{/each}} {{#each activities.tue.modules}} {{_module.name}} {{/each}} {{#each activities.wed.modules}} {{_module.name}} {{/each}} {{#each activities.thu.modules}} {{_module.name}} {{/each}} {{#each activities.fri.modules}}
{{_module.name}} {{/each}} {{#each activities.sat.modules}} {{_module.name}} {{/each}} {{#each activities.sun.modules}} {{_module.name}} {{/each}}
</td>
</tr>
<tr>
<td class="mod-title mobile-font-lg">
<p><b>Quiz Attempted</b></p>
</td>
</tr>
<tr>
<td class="attempted mobile-font-md">
{{#each activities.mon.quizzes}} {{quiz.name}} {{/each}} {{#each activities.tue.quizzes}} {{quiz.name}} {{/each}} {{#each activities.wed.quizzes}} {{quiz.name}} {{/each}} {{#each activities.thu.quizzes}} {{quiz.name}} {{/each}} {{#each activities.fri.quizzes}}
{{quiz.name}} {{/each}} {{#each activities.sat.quizzes}} {{quiz.name}} {{/each}} {{#each activities.sun.quizzes}} {{quiz.name}} {{/each}}
</td>
</tr>
<tr>
<td class="mod-title mobile-font-lg">
<p><b>Test Attempted</b></p>
</td>
</tr>
<tr>
<td class="attempted mobile-font-md">
{{#each activities.mon.tests}} {{test.name}} {{/each}} {{#each activities.tue.tests}} {{test.name}} {{/each}} {{#each activities.wed.tests}} {{test.name}} {{/each}} {{#each activities.thu.tests}} {{test.name}} {{/each}} {{#each activities.fri.tests}}
{{test.name}} {{/each}} {{#each activities.sat.tests}} {{test.name}} {{/each}} {{#each activities.sun.tests}} {{test.name}} {{/each}}
</td>
</tr>
</table>
</center>
</td>
</tr>
<tr>
<td style="padding: 25px 0 25px">
<p style="color:#6E6E6E;opacity: 0.8;" class="mobile-font-xl">Powered by Xamplay Edutech Pvt Ltd.
</p>
</td>
</tr>
</table>
</center>
</td>
</tr>
</table>
</body>
</html>
I have checked your code and I should say that your code would not be rendered properly on most of the devices and mail applications. some "div" and "pseudo-classes" have been used and I think you need to reconsider your design to avoid using such elements and syntaxes. Also, please make all of your styles in-line, then it would not be omitted by Mail Servers and Mail Applications. You can use the following link to validate/preview your email template.
Email HTML Validator
But for your primary question, I need to say that making Responsive Tables is a little bit hard and makes user experience issues for the customer, So I believe that you may have the following options to either have Accessibility and Customer Experience together:
1- Rethink about the design and do the design based on Customer Centricity Principles, For example, if your customers are probably using their phones for checking their emails ( most probable option ) so you need to consider that scrolling a Table or following a table on a small screen is not a good experience, so you need to make the design somehow horizontal or grouped in a not table-style block.
2- Put a Call to Action Button that opens a user-specific generated link that does not require user login and show the details with more interactive features like collapsable accordions with the power of Fully Supported CSS and JS engines.
3- Generated PDF and attach it to the email for the users. ( most of the users do not like it because it would need to be downloaded and allocating space on user devices, might it needs some applications to open it, and so forth. )
I am trying to send an email from outlook (office 365) as HTML format. There is a thin line appearing in a large screen monitor(27 inch or more) or with a zoom level 175%. The below code doesn't show any horizontal line with 100% zoom in office 365 outlook, but if I increase the zoom (Click tab , Format Text --> Zoom) to (170%-200%), a horizontal line appears randomly below some part of header ex; Information -2 header, title header (image attached).
Here is my html that I am inserting in outlook mail.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Request Submitted</title>
<style type="text/css">
#outlook a {
padding: 0;
}
/* Force Outlook to provide a "view in browser" button. */
body {
width: 100% !important;
/*line-height: 100%;*/
}
.ReadMsgBody {
width: 100%;
}
.ExternalClass {
width: 100%;
}
/* Force Hotmail to display emails at full width */
body {
-webkit-text-size-adjust: none;
}
/* Prevent Webkit platforms from changing default text sizes. */
/* Reset Styles */
body {
margin: 0;
padding: 0;
}
img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
}
.ExternalClass * {
line-height: 100%;
}
body,
h1,
h2,
h3,
h4,
h5,
h6,
div,
table,
u,
td,
p {
margin: 0;
margin-bottom: 0;
padding: 0;
}
body {
padding: 0;
font-family: "Segoe UI Light", "Segoe UI", "Arial";
}
h1 {
font-size: 24px;
font-weight: normal;
margin: 10px 0px;
}
h2,
.h2 {
display: block;
padding: 5px 10px;
background-color: rgb(195, 203, 211);
color: rgb(52, 73, 94);
font-size: 16px;
}
h4 {
margin-left: 9px;
}
div.statusLabel {
display: block;
height: 20px;
padding: 10px;
background-color: rgb(195, 203, 211);
margin-bottom: 10px;
margin-right: 20px;
}
div.statusLabel.partialStatus {
height: 36px;
}
div.statusLabel p {
color: #FFFFFF;
font-size: 16px;
line-height: 16px;
text-align: center;
text-transform: uppercase;
}
div.statusLabel span {
display: none;
}
div.statusLabel.partialStatus span {
display: inline;
}
div.statusTile {
display: block;
width: 98px;
height: 98px;
padding: 10px;
background-color: rgb(195, 203, 211);
border: 1px solid rgb(183, 192, 202);
margin-bottom: 20px;
margin-left: 10px;
float: left;
}
div.statusTile.leftTile {
margin-left: 0px !important;
}
div.statusTile p {
position: relative;
top: 36px;
color: #FFFFFF;
font-size: 16px;
text-align: center;
}
div.statusTile span {
display: none;
}
div.statusTile.twoLine span {
display: block;
}
div.statusTile.twoLine p {
top: 24px;
}
/*Colors*/
.submitted {
background-color: #0078D7 !important;
}
.approved {
background-color: #107C10 !important;
}
.reserved {
background-color: #FFB900 !important;
}
.noRibbon {
border: 0 !important;
}
table table table {
margin-top: -10px !important;
}
</style>
</head>
<body style="font-family: " Segoe UI ", open-sans, Geneva, Verdana, sans-serif;font-weight:lighter;">
<table id="tblMain" cellpadding="0" cellspacing="0" height="100%" width="100%" border="0">
<tbody>
<tr>
<td align="center" valign="top">
<table cellpadding="0" cellspacing="0" width="800" border="0">
<tbody>
<tr>
<td>
<p style="font-size:16px;margin:0px"><b><i>Email Heading.</i></b> </p>
<h1>This is a Test Email.</h1>
</td>
</tr>
<tr>
<td>
<table>
<tbody>
<tr>
<td width="28%" valign="top" style="padding:10px 0px 20px 0px;">
<table width="90%" border="0" cellspacing="10" cellpadding="10">
<tbody>
<tr style="padding-top:10px;">
<td style="padding:10;background-color:#0078D7;">
<p style="color:#FFFFFF;font-size:15px;line-height:17px;margin:0px;text-align:center;text-transform:uppercase;">Title - 1</p>
</td>
</tr>
<tr>
<td style="padding:10;background-color:rgb(195,203,211);">
<p style="color:#FFFFFF;font-size:15px;line-height:17px;margin:0px;text-align:center;text-transform:uppercase;">Title - 2</p>
</tr>
<tr>
<td style="padding:10;background-color:rgb(195,203,211);">
<p style="color:#FFFFFF;font-size:15px;line-height:17px;margin:0px;text-align:center;text-transform:uppercase;">Title - 3</p>
</td>
</tr>
<tr>
<td style="padding:10;background-color:rgb(195,203,211);">
<p style="color:#FFFFFF;font-size:15px;line-height:17px;margin:0px;text-align:center;text-transform:uppercase;">Title - 4</p>
</td>
</tr>
<tr>
<td style="padding:10;background-color:rgb(195,203,211);">
<p style="color:#FFFFFF;font-size:15px;line-height:17px;margin:0px;text-align:center;text-transform:uppercase;">Title - 5</p>
</td>
</tr>
</tbody>
</table>
</td>
<td width="72%" valign="top" style="padding:10px 0px 20px 0px;">
<!--Intro Text-->
<p style="line-height:20px;">Hello User,
</p>
<br /> Please ignore this email.
</p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="background-color:rgb(195,203,211);color:rgb(52,73,94);font-size:15px;padding:10px;"> <b style="color:rgb(52,73,94);">
Information - 1</b>
</td>
</tr>
<tr>
<td style="padding-top:10px; padding-bottom:20px;">
<table cellpadding="0" cellspacing="10" width="100%">
<tbody>
<tr>
<td width="50%"><b>Header 1</b>: <span></span> </td>
<td width="50%"><b>Header 2</b>: <span></span> </td>
</tr>
<tr>
<td width="50%"><b>Header 3</b>: <span></span> </td>
<td width="50%"><b>Header 4</b>: <span></span> </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td style="padding:5px 10px;background-color:rgb(195,203,211);"> <b style="color:rgb(52,73,94);font-size:16px;">Information - 2</b> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
I have modified the td padding, the line disappears for td padding 10px, but that is not consistent. Can you please help me how can I remove the horizontal line for zoom level 180%? This issue can be seen with a monitor 27 inch or more.
Thank you.
How would I make this table in the image above responsive with css, under 600px?
Wherein the 1st and 3rd columns are "headers" that turn into a simple list view on screens under 600px, like such-
https://jsfiddle.net/bycxL65r/7
<style>
.details td {
color: #000;
padding-top: 15px;
padding-bottom: 15px;
border-bottom: dotted #555555 1px;
background-color: transparent;
font-size: 16px;
}
.details td strong {
text-transform: uppercase;
}
.details {
border: none;
}
#media only screen and (max-width: 600px) { }
</style>
<div class="details">
<table width="100%">
<thead></thead>
<tbody>
<tr>
<td style="text-align: left; width: 6%;"><span><strong>Led by:</strong></span></td>
<td style="text-align: left; width: 31%;"><span><strong>Corey Parker</strong></span></td>
<td style="text-align: left; width: 10%;"><span><strong>Location:</strong></span></td>
<td style="text-align: left; width: 49%;"><span>The BGB Studio, 10999 Riverside Dr., Suite 301, North Hollywood, CA 91602</span></td>
</tr>
<tr style="background-color: transparent !important;">
<td style="text-align: left; width: 6%;"><span><strong>Dates:</strong></span></td>
<td style="text-align: left; width: 31%;"><span>April 9 - May 14. Sign up NOW as this class fills fast!</span></td>
<td style="text-align: left; width: 10%;"><span><strong>Requirements:</strong></span></td>
<td style="text-align: left; width: 49%;"><span><span style="font-size: 12pt;"><span>By application or invitation only. For actors who are auditioning consistently. </span></span><span style="font-size: 12pt;">There are no make-ups for this 6-week class. <a style="color: #cd2427;" href="http://bramongarciabraun.com/cancellation-policy/">(Cancellation Policy)</a></span></span>
</td>
</tr>
<tr>
<td style="text-align: left; width: 6%;"><span><strong>Duration:</strong></span></td>
<td style="text-align: left; width: 31%;"><span><span>6 weeks. Mondays, 7pm - 10pm.</span></span><span>
</span></td>
<td style="text-align: left; width: 10%;"><span><strong>Cost:</strong></span></td>
<td style="text-align: left; width: 49%;"><span>$480 for the entire 6-week program. 2 installments ($270 & $210).
</span></td>
</tr>
</tbody>
</table>
</div>
i'm creating a very basic html email layout, an one column layout:
this is the layout skeleton:
<html>
<head>
<body>
<table class="outer">
<tr> <!-- structure of a single row-->
<td class="one column">
<table>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr> <!--END of a row-->
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
</table>
</body>
</head>
</html>
in one row i have a button, its width is 100%:
<tr>
<td class="one-column">
<table width="100%">
<tr>
<td align="center" bgcolor="#cc9435" style="-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0px;" ><a href="#" target="_blank" style="font-size:16px;font-family:sans-serif, Helvetica, Arial;color:#ffffff;text-decoration:none;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;padding-top:12px;padding-bottom:12px;padding-right:18px;padding-left:18px;border-width:1px;border-style:solid;border-color:#cc9435;display:inline-block;" >button</a></td>
</tr>
<tr>
<td class="spacer">
</td>
</tr>
</table>
</td>
</tr>
css:
/* One column layout */
.one-column .contents {
text-align: center;
}
.one-column p {
Margin-bottom: 10px;
}
.outer {
Margin: 0 auto;
width: 100%;
max-width: 600px;
background-color: #ffffff
}
the button cover the entire width of the template, how can i make it smaller and centered? with on td in a row seems not quite possible, i try with setting margin but obviously doesnt work
thanks
The issues I found in the code are.
There is no need to capitalize CSS classes. Not an issue but just stating!
Since you are setting the background-color for the td element (bgcolor="#cc9435"), it seemed like the button was taking the full width of the table. I moved the background to the a tag alone using the background-color CSS property.
I have reduced the padding property to one line padding:12px 18px where 12px is for the top and bottom padding and 18px is for the left and right padding, you need to increase the left and right padding to see and increase in the width of the button.
Let me know if this fixes your issue!
.td-style {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding-top: 0;
padding-bottom: 0;
padding-right: 0;
padding-left: 0px;
}
.a-style {
font-size: 16px;
font-family: sans-serif, Helvetica, Arial;
color: #ffffff;
text-decoration: none;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
padding: 12px 18px;
border-style: solid;
border-color: #cc9435;
display: inline-block;
background-color: #cc9435;
}
.one-column .contents {
text-align: center;
}
.one-column p {
margin-bottom: 10px;
}
.outer {
margin: 0 auto;
width: 100%;
max-width: 600px;
background-color: #ffffff
}
<html>
<head>
<body>
<table class="outer">
<tr>
<!-- structure of a single row-->
<td class="one column">
<table>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
<!--END of a row-->
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr> </tr>
<tr>
<td class="one-column">
<table width="100%">
<tr>
<td align="center" style="td-style">
button
</td>
</tr>
<tr>
<td class="spacer">
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</head>
</html>
Add width and bg color only to a tag
<td align="center" style="-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;padding-top:0;padding-bottom:0;padding-right:0;padding-left:0px;">button</td>
Before update
https://jsfiddle.net/17oj738e
After Update
https://jsfiddle.net/17oj738e/1/
How can I make these buttons all align left with about a 3px space between them and adjust their own size based on how much text is put into them?
Unfortunately I don't have access to my own CSS (someone charges hundreds for this privilege). I've been trying for hours but just can't figure it out:
<br>
<style>
.mylink {
padding: 10px 35px;
background-color: #434343;
color: #fffFFF;
text-transform: uppercase;
letter-spacing: -.2px;
text-decoration: none;
font-family: helvetica,arial,sans-serif;
border-radius: 5px;
font-size: 12px;
width: 100%
}
.mylink:hover {
background-color: #ff0000; color: #fffFFF;
}
</style>
<table width="100%">
<tbody>
<tr>
<td width="0%" style="text-align: left;">
<a class="mylink" href="http://www.zzz.com/">ZZZ</a>
</td><td width="0%" style="text-align: left;">
<a class="mylink" href="http://www.aaa.com/">AAA</a>
</td><td width="0%" style="text-align: left;">
<a class="mylink" href="http://www.FFF.com/">FFF</a>
</td>
</td>
</tr>
</tbody>
</table>
Assuming that your other CSS is working by putting it inline (like you have put it), this should work, though a little hacky (floating cells and rows is ... unusual). I'd get rid of the table altogether if the effect here is what you want:
<style type="text/css">
.mylink {
padding: 10px 35px;
background-color: #434343;
color: #fffFFF;
text-transform: uppercase;
letter-spacing: -.2px;
text-decoration: none;
font-family: helvetica,arial,sans-serif;
border-radius: 5px;
font-size: 12px;
float:left;
}
.mylink:hover {
background-color: #ff0000; color: #fffFFF;
}
tr, td {
float:left;
padding:0;
}
</style>
<table>
<tbody>
<tr>
<td>
<a class="mylink" href="http://www.zzz.com/">ZZZZZZZZ</a>
</td>
<td>
<a class="mylink" href="http://www.aaa.com/">AAA</a>
</td>
<td>
<a class="mylink" href="http://www.FFF.com/">FFF</a>
</td><!-- Remove the extra </td> here. -->
</tr>
</tbody>
</table>
What this should look like if it works: https://jsfiddle.net/cmhqr3dg/
I believe this is the effect you are going for.
<br>
<style>
.mylink {
padding: 10px 35px;
background-color: #434343;
color: #fffFFF;
text-transform: uppercase;
letter-spacing: -.2px;
text-decoration: none;
font-family: helvetica,arial,sans-serif;
border-radius: 5px;
font-size: 12px;
width: 100%
}
.mylink:hover {
background-color: #ff0000; color: #fffFFF;
}
td {
float: left;
margin: 0 3px;
}
</style>
<table width="100%">
<tbody>
<tr>
<td>
<a class="mylink" href="http://www.zzz.com/">ZZZZZZZZZZ</a>
</td>
<td>
<a class="mylink" href="http://www.aaa.com/">AAAAAAAAAAAAAAAAAAAAA</a>
</td>
<td>
<a class="mylink" href="http://www.FFF.com/">FFF</a>
</td>
</td>
</tr>
</tbody>
</table>
I removed the style tags from the "td" elements and added the following into the "style" tags
td {
float: left;
margin: 0 3px;
}