Emails are experiencing issues with CSS elements not appearing correctly

I'm currently working on crafting a service desk ticket template to be disseminated via email. After consulting various online resources regarding the creation of dynamic email templates that will maintain a consistent appearance across different devices and email platforms, I've managed to achieve this outcome: https://i.sstatic.net/ACQR7.png

However, once the email is sent out, it transforms into a rather unattractive layout, seemingly disregarding the use of percentages for width (resulting in the loss of padding on the right side): https://i.sstatic.net/pUjEt.png

This issue persists across Outlook, Gmail, and iOS's Mail client. It appears that something is being overlooked or rendered ineffective within my header tag when it comes to emails, but pinpointing the exact problem has proven challenging. Any insights or solutions to address this breakdown would be greatly appreciated.

Edit: I should note that I also attempted utilizing Mailchimp's CSS inliner tool, yet the result remained identical. I even experimented with employing style="display: block;" for the img styles, only to find that it did not resolve the issue. Subsequently, I opted to remove the company image from the header of the ticket... to no avail.

Attached snippet:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
* {
box-sizing: border-box;
}
img {
display: block;
}
html {
font-family: "Lucida Sans", sans-serif;
}
.header {
font-size: 45px;
background-color: #bbbcbc;
width: 75%;
color: #000000;
padding: 15px;
}
.box {
width:75%;
border: 20px solid #bbbcbc;
margin: 0;
}
.case-number {
font-size: 20px;
background-color: #535659;
color: white;
width: 100%;
padding: 10px;
}
.date-opened {
font-size: 20px;
background-color: #bbbcbc;
color: #000000;
width: 100%;
padding: 10px;
}
.body {
font-size: 20px;
background-color: white;
color: black;
width: 100%;
padding: 15px;
}
.ttable th {
width: 20%;
text-align: left;
background-color: #bbbcbc;
border: 1px solid #bbbcbc;
padding: 5px;
margin:0;
}
.ttable td {
width: 60%;
border: 1px solid #bbbcbc;
padding: 5px;
margin:0;
}
.footer {
width: 100%;
background-color: #bbbcbc;
color: black;
text-align: center;
padding-top: 20px;
}

</style>
</head>
<body>

<div class="header">
<img src="" style="display: block;"/>
</div>
<div class="box">
<div class="case-number">Case Number: 123456</div>
<div class="date-opened">Date Opened: 14 June 2018 at 12:00 PM</div>
<div class="body">
You are receiving this email because your case has been updated. Your case details and any updates can be found below this message. 
<br></br>
If you wish to post a comment to the case you can simply reply to this email and your case will be updated.
If you would like to include a screenshot or relevant log files you can do so by including them in your reply. 
<br></br>
[progress bar goes here]
<br></br>
In order to proceed with your case we will need additional information or clarification on the reported issue. 
Please provide the requested information within the next 4 days. 
If no response is received during this time we will temporarily archive your case. 
Once you are ready to continue with simply reply to one of the case emails.
<br></br>
<div class="ttable">
<table>
<tr>
<th>Subject</th>
<td>TICKET SUBJECT HERE</td>
</tr><tr>
<th>Description</th>
<td>TICKET DESCRIPTION HERE</td>
</tr>
</table>
</div>
</div>
<div class="footer">

</div>
</div>


</body>
</html>

Answer №1

Based on the images provided, it appears that the standard box-sizing: border-box; property is not being applied. To address this issue, consider refraining from using the border settings for the outer container (.box). Instead, opt for padding: 20px (equivalent to the previous border thickness) and apply a background-color matching the previous border-color to achieve a border-like effect. It may be necessary to remove box-sizing: border-box;.

Answer №2

Considering the lack of support for box-sizing in many email clients, it may be wise to explore alternative options.

  • Learn more about box-sizing here

It's worth noting that Outlook's support for padding and margin can be buggy.

  • Check out information on padding support in Outlook

Additionally, Outlook doesn't have strong support for <div>.

When it comes to setting width, keep in mind that declaring a hard value like width="600" tends to work better in Outlook compared to using width="100%". While most modern email clients utilize width: 100% !important;, Outlook often disregards this style declaration.

Outlook Desktop and Android both do not recognize @media queries, so be sure to specify CSS values tailored for Gmail, IOS, and other compatible clients.

If you want Android and Outlook to display background colors correctly, consider inlining them in tables or using <table bgcolor="#ff0000">.

Your template has potential but could benefit from some fine-tuning to enhance its performance across various email clients.

Best of luck as you make these adjustments!

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

Add a script tag to every image in my HTML at once using C#

Managing a site with a thousand images can be overwhelming, especially when trying to add a script tag like <%=Settings.MyDomain%> to each one. I'm looking for a more efficient way to accomplish this task without spending hours on manual labor. ...

Implementing CSS transitions across several elements simultaneously can enhance the user experience

There seems to be an issue with animating two elements simultaneously using max-height. The transition always occurs one after the other, with one element completing its transition before the other starts. setTimeout(function () { $(".b").css( ...

Tips on concealing the divs following the second click and a page refresh

Bootstrap 4 js collapse is working fine, but I am facing an issue. When I click to show a hidden div and then reload the page, clicking again reveals the previously hidden div when it should be hidden. Any suggestions for addressing this problem? ...

Is it possible for bs.reload(*.html) to refresh all HTML files located within the app directory?

Does browser-sync automatically refresh all HTML files within the app directory when Node is started with this configuration? // require the module as normal var bs = require("browser-sync").create(); // .init starts the server bs.init({ server: "./a ...

Using VueJS to link an object of properties to an element

in Vue js, let's consider the following code: <script setup> import { Link } from "@inertiajs/vue3"; import { reactive } from 'vue' </script> <template> <div data-bs-toggle="collapse" ...

Issue with Bootstrap causing individual scroll panels for each column to be unresponsive

Hello, I'm currently using Bootstrap to build a website from scratch. This is my first time working with Bootstrap, so I might be making some errors along the way. My current challenge involves creating individual scroll panels for each of the 3 cont ...

How can I adjust the widths of two input fields in a jQuery select box?

I found this cool jquery plugin that enhances the appearance of select dropdown boxes. You can check it out here: http://code.google.com/p/select-box/ Take a look at this fiddle to see how it works: http://jsfiddle.net/FQKax/1/ I've been trying to m ...

Adjusting the vertical dimension of an Angular 17 Material Dropdown Field?

Check out this demo where I'm exploring ways to decrease the height of the select field. Here's the code snippet: <mat-form-field appearance="outline"> <mat-label>Toppings</mat-label> <mat-select [formControl]=& ...

Locate the highest subsequent elements using XPath

When working with XPath, I am aware that I can target all subsequent elements using /following::*. However, my goal is to specifically avoid selecting the child elements nested within those subsequent elements. For instance, considering this sample docume ...

The proper method for organizing intricate forms in HTML

I'm at my wits' end with this issue. Hours of searching online and reading the manual have been fruitless. I need insights from experts on how to handle a form that is spread across multiple divs. Initially, I tried wrapping all the divs in a sin ...

Guide to incorporating external CSS and JavaScript into an Angular 2 project with Express.js and Node.js

As a newcomer to Angular2 and NodeJs, I am eager to learn how to integrate external CSS and JS in an Angular2 and Nodejs express app. Specifically, I am looking to integrate a bootstrap admin theme into my Nodejs application. The screenshots below provide ...

What are the steps to establish a distinct websocket channel?

Imagine wanting to establish a chatroom with one public room and user-generated private rooms. How can Websocket facilitate the creation of private channels for these rooms? Platforms like Pusher and JWebSocket offer solutions for this, but what if you pr ...

What specific component of the coding determines the appearance of the hover feature on the sub menu?

I am new to web development. I recently grabbed this code snippet from bootstrap.com and I'm trying to customize it. I've managed to change the color of the navigation menu by modifying the CSS, but I'm struggling to identify which part of t ...

Expanding containers with flexbox to allow for flexibility in size

I need help with a page that contains 3 div elements, where 2 of them need to be resizable. These elements should be able to be moved left or right, and maximized or minimized. You can view the example on Stackblitz. The issue I'm facing is that som ...

A guide on grouping an entire CSS file under one class umbrella

Is there a way to encapsulate a large number of CSS declarations so they only apply when the parent has a specified class? div { color: #ffffff; } ... a { color: #000000; } Can it be structured like this, with a parent class containing all the CSS r ...

The background color and border are failing to apply

I've been struggling to set a background color for the class="imgd", but I can't seem to make it work. .portrait { border: #C7C7C7 solid 1px; } .circular--square { border-radius: 50%; padding-right: 10%; padding-bottom: 10 ...

What are the reasons behind the occasional failure of vertical centering using height/line-height?

When it comes to CSS single line vertical centering using line-height, I often run into a problem. My usual approach is setting the height and line-height without padding, particularly for buttons: height: 44px; line-height: 44px; However, there are time ...

What are the essential requirements to fully implement Ext.QuickTips()?

I'm revisiting a previous question, with a focus on the concept rather than my specific issue. Currently exploring Saki's Form Examples, specifically, Displaying Form Submit Errors. Using Ext-JS 3.3.0 and aiming for similar functionality in my d ...

Fill an HTML table with comma-separated values (CSV) information

After conducting some research on the internet, I attempted to modify a jQuery script in order to populate an HTML table with data from a CSV file. However, I encountered an issue as the table remained empty. Below, you can find the code that I used. Any a ...

Multiple hover highlighting techniques

Recently, I came up with an interesting concept for providing user feedback. My idea is to have a menu where hovering over it highlights an image that corresponds to the menu item, or vice versa - hovering over an image will highlight the corresponding men ...