Home > Blockchain >  CSS in Outlook email its not working properly
CSS in Outlook email its not working properly

Time:02-14

I have been working on a project and one of the features is to send an email verification message. I am trying to optimize it especially for the outlook platform. The problem I have been encountering is that the flex-box is not working as it should on the mobile app, but on the web app is working just fine. I am using flex-direction: column but it displays as row. Is there any way to overcome this?

*,
*::after,
*::before {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html {
    font-family: 'Fabula Valhalla';
    font-weight: normal;
    font-style: normal;
    color: #FFFFFF;
    font-size: 16px;
}

body{
    width: 100vw;
    height: 100vh;
}

.background{
    width: 100vw;
    height: 100vh;
    background-color: #151A29;
    display: flex;
    justify-content: center;
    align-items: center;
}

.main-container{
    background-color: rgba(0, 0, 0, 0.33);
    width: 80%;
    height: auto;
    padding: 35px;
    display: flex;
    align-items: center;
    flex-direction: column;
    border-radius: 25px;
}

.image{
    width: 90%;
    border-radius: 25px;
    border: solid 2px #B94E36
}

h1{
    margin-top: 30px;
    font-size: 46px;
    letter-spacing: 2px;
}

.text-container{
    margin-top: 30px;
    width: 80%;
    text-align: center;
    font-size: 22px;
    letter-spacing: 2px;
    line-height: 24px;
}

.button{
    margin-top: 40px;
    text-decoration: none;
    color: black;
    font-size: 1.6rem;
    background-color: #EBA550;
    border-radius: 25px;
    padding: 15px 50px;
    margin-bottom: 20px;
}

CodePudding user response:

While display:flex has pretty good support across email clients, flex-direction:row has not. So in your example, both flex-direction: column; and align-items: center; would be stripped out from Outlook.com or Outlook on iOS and Android, leaving you with just the defaults that come with display:flex (corresponding to flex-direction:row and align-items:stretch).

I’d recommend using another layout method more compatible with email clients, like display:inline-block or tables.

  • Related