Adding CSS to Emails?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2014 06:40 AM
We are looking for adding CSS (Adding a arrow shapes to showcase the state) in the Email we designed. We had used mail scripts and script include which are called from Email Notification.(Email notification calls mail script, Mail script calls the function in script include which returns html content of the mail design) . In script include we get style tag and its content(populated from local style sheets) and returning it to notification but it is not reflecting properly.
Is there any way to add CSS to Email notifications? or Is there any way to add style tag or head tag to notification.
Note: We have also used email templates where CSS worked but for few browsers(IE8,9 ,chrome). it comments the style tag and the CSS is not working as expected.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-21-2015 07:25 PM
I have changed up my CSS and HTML to not include a background image. We didn't like the issues with images looking like attachments on email and also when forwarding the email, the image didn't stay inline with the email.
Here is the revised version as it is displayed after you save the HTML message code and then click on "source code":
HTML
- <div>${mail_script:1CALLEmail.styles}
- <title>1CALL Facility Services</title>
- <style type="text/css"><!--
- table.container{
- font-family: sans-serif, Arial, Helvetica;
- font-size: 18px;
- }
- td.headerbg{
- height: 5em;
- padding-bottom: 30px;
- border-bottom: 2px solid #ffffff;
- }
- .headercontent{
- padding-top: 20px;
- width: 16em;
- height: 5em;
- margin: 0 auto;
- }
- .one{
- border-radius: 100%;
- height: 3.8em;
- width: 3.8em;
- background-color: #b20838;
- float: left;
- margin-left: 5px;
- position: relative;
- margin-left: 10px;
- }
- .one p.numberone{
- margin-top: 0em;
- font-size: 3.5em;
- font-weight: bold;
- color: #ffffff;
- }
- .call{
- width: 2.8em;
- height: 1em;
- float: left;
- font-size: 4em;
- margin-right: 5px;
- font-weight: bold;
- color: #140c13;
- text-align: left;
- float: right;
- position: relative;
- line-height: 70px;
- }
- .facilityservices{
- clear: both;
- width: 220px;
- color: #939598;
- font-size: 1.1em;
- font-weight: lighter;
- text-align: center;
- letter-spacing: 2px;
- }
- .fs{
- padding-top: 5px;
- line-height: 1.1em;
- }
- .clear{
- clear: both;
- }
- @media only screen and (max-width: 599px){
- table.container { width: 100% !important; }
- table.container td{ border-left: none !important; border-right: none !important;}
- td.headline h1 { font-size: 16px !important;}
- td.request_openedat { font-size: 13px !important; line-height:15px !important; }
- td.request_category { font-size: 13px !important; line-height:15px !important; }
- td.request_assignedto { font-size: 13px !important; line-height:15px !important; }
- td.request_shortdescription { font-size: 13px !important; line-height:15px !important; }
- td.request_comments_title { font-size: 13px !important; line-height:15px !important; }
- td.request_comments{ font-size: 13px !important; line-height:15px !important; }
- td.headerbg{ border-bottom: 2px solid #ffffff; padding-bottom: 10px !important;}
- .headercontent{ width: 12.75em;}
- .one{ border-radius: 100%; height: 3em; width: 3em; background-color: #b20838; float: left; position: relative; margin-left: 10px;}
- .one p.numberone{ font-size: 2.8em; line-height: 1.1em;}
- .call{ width: 2.8em; height: 1em; float: left; font-size: 3em; font-weight: bold; color: #140c13; line-height: 55px; margin-left: 5px;}
- .fs{ font-size: .8em !important;}
- }
- @media only screen and (max-width: 526px) {
- table.container { width: 100% !important;}
- td.headline h1 { font-size: 14px !important; line-height: 16px !important; text-align: center;}
- td.request_openedat { font-size: 12px !important; line-height:14px !important; }
- td.request_category { font-size: 12px !important; line-height:14px !important; }
- td.request_assignedto { font-size: 12px !important; line-height:14px !important; }
- td.request_shortdescription { font-size: 12px !important; line-height:14px !important; }
- td.request_comments_title { font-size: 12px !important; line-height:14px !important; }
- td.request_comments{ font-size: 12px !important; line-height:14px !important; }
- td.headerbg{ border-bottom: 2px solid #ffffff !important; padding-bottom: 10px !important;}
- .headercontent{ width: 12.75em;}
- .one{ border-radius: 100%; height: 3em; width: 3em; background-color: #b20838; float: left; position: relative; margin-left: 10px;}
- .one p.numberone{ font-size: 2.8em; line-height: 1.1em;}
- .call{ width: 2.8em; height: 1em; float: left; font-size: 3em; font-weight: bold; color: #140c13; line-height: 1em; margin-left: 5px;}
- .fs{ font-size: .8em !important;}
- }
- @media only screen and (max-width: 414px) {
- table.container { width: 100% !important;}
- td.headline h1 { font-size: 13px !important; line-height: 14px !important; text-align: center;}
- td.request_openedat { font-size: 11px !important; line-height:13px !important; }
- td.request_category { font-size: 11px !important; line-height:13px !important; }
- td.request_assignedto { font-size: 11px !important; line-height:13px !important; }
- td.request_shortdescription { font-size: 11px !important; line-height:13px !important; }
- td.request_comments_title { font-size: 11px !important; line-height:13px !important; }
- td.request_comments{ font-size: 11px !important; line-height:13px !important; }
- td.headerbg{ border-bottom: 2px solid #ffffff !important; padding-bottom: 10px !important;}
- .headercontent{ width: 11em; height: 3em;}
- .one{ border-radius: 100%; height: 2.5em; width: 2.5em; background-color: #b20838; float: left; position: relative; margin-left: 10px;}
- .one p.numberone{ font-size: 2.2em; line-height: 1.2em;}
- .call{ width: 2.8em; height: 1em; float: left; font-size: 2.5em; font-weight: bold; color: #140c13; line-height: 1em; margin-left: 5px;}
- .facilityservices{ width: 8em !important;}
- .fs{ font-size: .6em !important;}
- }
- @media only screen and (max-width: 375px) {
- table.container { width: 100% !important;}
- td.headline h1 { font-size: 12px !important; line-height: 13px !important; text-align: center;}
- td.request_openedat { font-size: 10px !important; line-height:12px !important; }
- td.request_category { font-size: 10px !important; line-height:12px !important; }
- td.request_assignedto { font-size: 10px !important; line-height:12px !important; }
- td.request_shortdescription { font-size: 10px !important; line-height:12px !important; }
- td.request_comments_title { font-size: 10px !important; line-height:12px !important; }
- td.request_comments{ font-size: 10px !important; line-height:12px !important; }
- }
- --></style>
- <table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tbody>
- <tr>
- <td>
- <table class="container" border="0" width="600" cellspacing="0" cellpadding="0" align="center" font-family:="" sans-serif="" arial="" helvetica="" font-size:="" 18px="">
- <tbody>
- <tr>
- <td class="headerbg" align="center" valign="top" bgcolor="#eaeaea">
- <div class="headercontent">
- <div class="one">
- <p class="numberone">1</p>
- </div>
- <div class="call">CALL</div>
- <div class="facilityservices">
- <p class="fs">FACILITY SERVICES</p>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <td class="headline" style="padding: 10px 0px 5px 0px; border-bottom: 2px solid #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 16px; line-height: 18px;" align="center" valign="top" bgcolor="#eaeaea">
- <h1 style="font-weight: normal; font-size: 20px; color: #606060;">REQUEST UPDATE</h1>
- </td>
- </tr>
- <tr>
- <td class="request_openedat" style="padding: 15px 30px 20px 30px; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 16px; color: #939598;" valign="top" bgcolor="#eaeaea"><span style="color: #b3083a;"> Request #:</span> <span style="color: #000000;">${number}</span>, was updated regarding issue, <span style="color: #000000;">${category}</span>. Please see the below comments.</td>
- </tr>
- <tr>
- <td class="request_comments_title" style="padding: 10px 30px 5px 30px; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 16px; color: #000000;" valign="top" bgcolor="#c0c0c0">Comments:</td>
- </tr>
- <tr>
- <td class="request_comments" style="padding: 5px 30px 20px 30px; border-bottom: 2px solid #ffffff; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 16px; color: #ffffff;" valign="top" bgcolor="#c0c0c0">${comments}</td>
- </tr>
- <tr>
- <td class="footer" style="padding: 10px 0px 10px 30px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #939598;" valign="top" bgcolor="#eaeaea">© 2015 | A service of University Hospitals Authority & Trust</td>
- </tr>
- </tbody>
- </table>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
This is what it should look like
This is what is sent out and received