Looking for assistance with CSS styling for an email design

I recently created an Email Template for one of our clients, but I am facing an issue. The color in the email shows up fine when I preview it in the system. However, once the email is received, the format remains intact but the colors disappear, turning the email into a black and white photo.

Here is the CSS Code I used:

<p style="text-align: left;"><span style="font-family: cambria;"> <span style="font-size: 18pt;"> <span style="color: #00629f;">IBM Service Desk</span> </span> </span> <span style="font-family: cambria;">&nbsp;<img style="align: right;" title="" src="sys_attachment.do?sys_id=0d50b5462f49c010209857892799b644" alt="" width="60" height="60" align="right" border="" hspace="" vspace="" /></span></p>
<style><!--
table {
font-family: cambria;
}
td.bg1{
background-color:#E2E2E3;
color:#00629F;

}
td.bg2{
color:black;
}
--></style>
<table style="width: 100%;">
<tbody>
<tr>
<td style="height: 40px;" colspan="5">
<p>Click here to view Incident: ${URI_REF}</p>
</td>
</tr>
<tr>
<td class="bg1" colspan="5">Short Description</td>
</tr>
<tr>
<td class="bg2" colspan="5">${short_description}</td>
</tr>
<tr>
<td class="bg1" colspan="5">Description</td>
</tr>
<tr>
<td class="bg2" colspan="5">${description}</td>
</tr>
</tbody>
</table>
<hr />
<p><span style="font-family: cambria;"><span style="font-size: 12pt;">Thank you</span>,</span></p>
<p><span style="font-family: cambria;"><span style="font-size: 14pt;"><span style="color: #00629f;">IBM Service Desk</span>&nbsp;</span></span></p>

When I previewed the email in the system, this was the output: System Preview Email

However, when the email is received in Outlook, it looks like this: Outlook Email

Answer №1

There are no major errors in your code, but please organize it properly. The table data color is not displayed because the style property is not being utilized correctly. You have placed the style tag alone in your code; please move it into the head tag for it to work fine.

<head>
   <style>
      table {
      font-family: cambria;
      }
      td.bg1{
      background-color:#E2E2E3;
      color:#00629F;
      }
      td.bg2{
      color:black;
      }
   </style>
   </head
<body>
   <p style="text-align: left;"><span style="font-family: cambria;"> <span style="font-size: 18pt;"> <span style="color: #00629f;">IBM Service Desk</span> </span> </span> <span style="font-family: cambria;">&nbsp;<img style="align: right;" title="" src="sys_attachment.do?sys_id=0d50b5462f49c010209857892799b644" alt="" width="60" height="60" align="right" border="" hspace="" vspace="" /></span></p>
   <style>
   </style>
   <table style="width: 100%;">
      <tbody>
         <tr>
            <td style="height: 40px;" colspan="5">
               <p>Click here to view Incident: ${URI_REF}</p>
            </td>
         </tr>
         <tr>
            <td class="bg1" colspan="5">Short Description</td>
         </tr>
         <tr>
            <td class="bg2" colspan="5">${short_description}</td>
         </tr>
         <tr>
            <td class="bg1" colspan="5">Description</td>
         </tr>
         <tr>
            <td class="bg2" colspan="5">${description}</td>
         </tr>
      </tbody>
   </table>
   <hr />
   <p><span style="font-family: cambria;"><span style="font-size: 12pt;">Thank you</span>,</span></p>
   <p><span style="font-family: cambria;"><span style="font-size: 14pt;"><span style="color: #00629f;">IBM Service Desk</span>&nbsp;</span></span></p>
</body>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What are some solutions to correct a tab layout that is utilizing absolute positioning?

Although I understand how absolute positioning works, it is currently disrupting the layout in this particular case. Using min-height with media queries for various screen sizes seems like a viable solution, but it's not foolproof considering that the ...

Creating collapsible column functionality for the <td> element within a <tr> in mobile view using React

Ensuring my websites have a consistent look across various devices is a top priority for me. I currently have a table that is displayed like this: https://i.sstatic.net/a91LL.png Is there a way to modify this table so that when viewed on mobile, the < ...

What is the best way to align my asp.NET panels in the center?

I am working with panels that have tables to organize textboxes and labels. I want to center them, but I am struggling to find the right attribute to use. I've attempted justifying them in the design view and using horizontalalign:center in HTML, but ...

Changing text content of an element with dynamic formatting

When a link is clicked on, I want to dynamically set the text. Here is the current code: <a href="www.somelinkhere.com" onclick="getElementById('setText').innerHTML='text to replace'" target="someIFrame" ...

Is there a way to use jQuery draggable to move a zoomed image within a div clipping mask?

Looking to enhance user experience, I am developing an interface that allows users to zoom in on an image and move the zoomed version within a clipping mask div. I have created a div with dimensions of 200px by 200px and set overflow: hidden. Then, I inse ...

Applying inline styles in PHP using if/else conditions

I want to customize the appearance of my table based on the status of each entry. Specifically, Completed = Green & Pending = Orange This involves PHP code that retrieves data from a MySQL database. $query = mysql_query("SELECT * FROM cashouts WH ...

Accessing elements from an array and performing addition on those that are numerical

I am trying to figure out how to extract the values from an array created by some code and then combine them into a single variable: var selector = 'input[name^="Textbook"]'; $(selector).on('click', function() { ...

Support for Chrome in Angular 8

Can someone please advise on the minimum version of Google Chrome that is supported by Angular 8? Additionally, I am looking for a way to prompt users to update their Chrome browser if it doesn't meet the required version. My Angular application seems ...

What are some ways to prompt electron to refresh its rendering with updated CSS?

I am currently in the process of developing my first Electron app on Windows 10, using Visual Studio Code and Git Bash as my primary tools. However, I have encountered a frustrating issue where my app has suddenly stopped updating based on css changes. Spe ...

Arranging all text boxes in a horizontal line: A simple guide

Is there a way to align all text boxes in a single row that works properly in both IE and Chrome browsers? IE 11 display: https://i.sstatic.net/wGITo.png Chrome display: https://i.sstatic.net/jXs0r.png Textboxes are not aligned properly as shown below: ...

Issue with displaying list items in Ajax Accordion with CSS

I have implemented an accordion control extender on my webpage, and it is functioning properly. I added a CSS file to display it as a list, which is working perfectly in all browsers except for IE compatibility view. In IE compatibility view, the list-styl ...

Unable to achieve full width for a div within a scrollable container

Currently, I am in the process of constructing a new website using Gatsby.js. However, I have encountered a minor issue with some CSS related to code blocks. Since CSS is not my strong suit, I have been unable to resolve it thus far. Below is a runnable sn ...

Tips for reactivating a disabled mouseover event in jQuery

I created an input field with a hover effect that reveals an edit button upon mouseover. After clicking the button, I disabled the hover event using jQuery. However, I am unable to re-enable this hover event by clicking the same button. Here is the code s ...

What is the secret behind the functionality of the download stats page on the Firefox website?

Check out the Mozilla website for real-time download statistics on Firefox: I noticed that there doesn't seem to be a continuous connection in Firebug. How are they retrieving and displaying this live data? What method is being used for this functio ...

The combination of Asp.net and Bootstrap offers a powerful

I am facing an issue with using Bootstrap in my ASP.NET project. The page displays correctly on a desktop, but when I resize the page to mobile phone size, the navigation panel does not stay in dropdown position. Here is my code: <%@ Page Language="C ...

Incorporating a hyperlink into the footer text of a WordPress site using the Darina theme developed by Besquares

I'm having trouble inserting hyperlinks in my footer text. The Wordpress theme I am using (darina by bessquare) allows for editing the footer text in the customizer section, but it only accepts plain text and not codes. I want to input text with hype ...

How can I make my navbar stay fixed in place and also activate the transform scale functionality?

After fixing the position of my navbar with the class "top," I noticed that the transform property scale does not work on the div element I applied. The hover effect on the box only works when I remove the position from the navbar. This is the HTML code: ...

PHP form does not seem to be vulnerable to cross-site scripting attacks

On one of my web pages, I have a form with an action php page using the following html syntax: <form name="form" action="test.php" method="get"> I decided to make it more secure by modifying it to: <form name="form" action="<?php echo htmlsp ...

What is causing my Bootstrap Controls to malfunction?

I'm trying to create a Bootstrap carousel that shows 3 items at once and includes controls to switch between them. The carousel I've made does display the three items, but for some reason, the controls are not responding when clicked. I'm un ...

CSS Image Width Percentage Guide

After incorporating Bootstrap into my ASP.NET webpage, I ran into issues when using percentages in the width attribute. Strangely enough, everything worked fine when I switched to pixels instead of percentage. Check out the images below for a visual refere ...