The text in Outlook for Windows emails is being obscured by a button that is overlapping it

As a newcomer to HTML email development, I've encountered an issue that has been puzzling me for the past few days. The problem lies in creating a two-column layout where the left column contains an image and the right column holds text along with a button.

The challenge seems to be the alignment of the columns vertically and the placement of the button within the layout. While the vertical alignment of the column can be set to top, middle, or bottom, the button's alignment options are left, center, or right. However, when the column's alignment is set to valign="middle" and the button's alignment is either align="left" or align="right", the button ends up overlapping the text. This issue appears to be specific to Outlook for Windows, as the layout looks fine in Outlook for Mac.

To illustrate, here is how it appears in Outlook for Windows-https://i.sstatic.net/9fnRo.jpg

And here is how it should look on Outlook for Mac (which is the expected outcome for Windows)-https://i.sstatic.net/JcYf4.jpg Here is the complete code snippet of the email-

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta charset="utf-8" />
    <meta name="x-apple-disable-message-reformatting" />
    <meta name="viewport" content=" width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>sdf</title>
    <!--[if gte mso 9]>
      <xml>
        <o:OfficeDocumentSettings>
          <o:AllowPNG /> <o:PixelsPerInch>96</o:PixelsPerInch>
        </o:OfficeDocumentSettings>
      </xml>
    <![endif]-->
    <style type="text/css" data-premailer="ignore">
      @media screen and (max-width: 600px) {
        @-ms-viewport {
          width: 320px;
        }
      }
    </style>
    ...

Furthermore, I have shared a Codepen example here.

My suspicion is that the issue might be related to the button's align property behaving like float:left or float:right, causing the button to be taken out of the normal document flow.

Any insights or suggestions would be greatly valued.

Answer №1

Here is a snippet of HTML code that includes CSS styling specifically tailored for various email clients to ensure compatibility.

   <style>
     
     body{
      background-color:#f2f2f2;  
     }
     
     .tableCenter{
       border-collapse:collapse;
       margin:auto; 
       max-width:600px; 
       background-color:white;
       font-family: 'Arial', 'Helvetica', sans-serif;
       font-weight:400;
       line-height:20px;
       font-size:15px;
     }
     
     
     .tableCenter button{
       color:white;
       padding:10px;
       border:none;
       font-weight:bold;
       background:rgb(128, 128, 128);
     }
   </style>
   
   <table class='tableCenter'>
     <tr>
       <td style='width:55%'>
         <img src='https://images-stage.apsis.cloud/804df07c-3e81-4f8a-8518-182572b51512.jpeg' width='100%'>
       </td>
       <td style='width:40%; padding:20px'>
         <p>
         A das observantia non est recedendu vitae dictum. Gallia atilitatis, obscuris et malesuada fames.
         </p>
         
         <button>Button</button>
       </td>
     </tr>
   </table>

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

Arranging DIVs in a vertical layout

Currently, I am working on a design that involves organizing several <DIV> elements in a vertical manner while still maintaining responsiveness. Here are some examples: Wider layout Taller layout I have tried using floats, inline-block display, ...

OpenStreetMap is failing to display the full map within the designated div

Here is the code snippet for displaying a map when clicking on a Span text, but not showing it in full: var latitude = document.querySelector('#lati').value; var longitude = document.querySelector('#longi').value; var open_address = doc ...

Tips for creating a responsive carousel slider for images

No matter how much I've tried, I can't seem to find a solution on how to make my image responsive along with the caption. Below is my HTML code: <section id="banner"> <div class="banner-bg"> <div class="banner-bg-item ...

Modifying the image height in a column using Bootstrap and JSON data

My webpage is dynamically generating images from a JSON file through a JavaScript file. However, the images are displaying at different heights, and I want each column to adjust to the height of the image to eliminate any gaps. Particularly, data with the ...

If I desire to utilize a particular font that I am aware is not readily accessible on the majority of users' computers

Is it possible to embed a specific font into my website if I know it's not commonly available on users' computers? I've seen some websites using unique fonts as text and not images, so I'm curious about how that is achieved. Thank you, ...

Protect database entries from cross-site scripting attacks

I have a project in progress where I am developing an application that extracts text from tweets, saves it to the database, and then presents it on the browser. I am currently concerned about potential security risks if the text contains PHP or HTML tags. ...

Loading asp.net controls dynamically using JavaScript

In the process of creating ASP.NET controls that facilitate the development of dynamically generated websites based on a class.cs file, these controls are loaded into a Placeholder within an update panel. My goal is to leverage technologies like AJAX and ...

Is there a way to generate a checkerboard dynamically with the help of jQuery?

I've made some progress so far, but I'm facing a challenge where I need to push 8 <td> elements into 8 different <tr> elements without hardcoding anything or modifying the HTML directly. Any help would be appreciated! JavaScript v ...

Approaching fashion from a new angle: incorporating perspective into

How can I style elements in the perspective to appear straight(3d) instead of flat due to perspective? I want to achieve a design where the alphabets and flag post image align perfectly. https://i.sstatic.net/HcHMC.jpg .container { perspective: 100p ...

Tips for aligning a logo in the center of a navigation bar

I'm struggling to center a logo within the navigation bar of a website I am designing. Despite my attempts, I have not been successful in achieving the desired result. My goal is to have the logo positioned in the middle of the navigation bar, with ot ...

The error message indicates a validation issue with the img tag: The attribute src has an invalid value, as it uses a backslash () as a path segment delimiter instead of

<div class="logo"> <img src="assets\images\main-logo\logo.jpg" alt="logo"> </div> </a> </div> The code was validated using validate.w3.org and this error was encountered: Bad value asse ...

Images are not being shown on the desktop carousel display

I am encountering an issue with my carousel. When I attempt to decrease the height of the carousel, the entire image is not being displayed properly (on desktop), although it works fine on mobile devices. My goal is for the carousel not to take up the ent ...

The HTML table seems to be inexplicably replicating defaultValue values

I'm encountering an issue where, when I use JavaScript to add a new table data cell (td), it ends up copying the defaultValue and innerText of the previous td in the new cell. This is confusing to me because I am simply adding a new HTML element that ...

Tips for preventing extra whitespaces and line breaks from being added to the render tree in Blazor applications

Consider the code snippet below <div> @for (int i = 0; i < 10; i++) { <span class="@classes[i]">@i</span> } </div> The desired output is (with each character styled differently) 01234567890 Howev ...

The height of the container is not adjusted correctly after loading data via ajax which causes it to overlap with

My HTML code consists of a container with two columns (content and sidebar) and a footer. The content contains a horizontal list with li elements that are populated via ajax when the "Load More" button is pressed. I am using Bootstrap and testing on Chrome ...

What is the method for altering the color of just the text in an anchor link?

Here is the code snippet I’m working with: <a href="#" title="some title"> <span>Do not change color of this text</span> Want to only change this text color </a> I am trying to change the color of the anchor tag text only, w ...

Guide to customizing WordPress header menu buttons with CSS, excluding a specific button

I need help with custom CSS for my WordPress site. I want to apply a hover effect to all menu buttons except for the "Contact" button, which already has its own styling. The CSS code adds a growing line beneath the hovered menu item and a static line unde ...

Looking to pass two distinct variables using a single props with v-if in Vue-JS. Any suggestions?

I am attempting to pass different data to my other component. Essentially, when my variable firstvalue is not null, I want to send firstvalue. Currently, this setup is functioning as expected. However, I now wish to send secondvalue if it is not null. < ...

Achieving a Side-Along Sidebar with CSS, Fully Embracing

I'm encountering an issue with achieving 100% height using CSS. Despite my extensive search for tutorials and solutions, I haven't been able to achieve the desired results. My layout consists of a sidebar and a main column where the content will ...

Creating a lifelike sinusoidal flag animation or flutter effect using SVG格式

I'm attempting to create a lifelike animated svg flag that flutters in the wind. Currently, I am using this simple flag base: <svg xmlns="http://www.w3.org/2000/svg" width="200px" height="100px" viewBox="0 0 200 100" > <p ...