【问题标题】:CSS in Outlook email its not working properlyOutlook 电子邮件中的 CSS 无法正常工作
【发布时间】:2022-02-14 17:29:58
【问题描述】:

我一直在从事一个项目,其中一项功能是发送电子邮件验证消息。我正在尝试优化它,特别是针对 Outlook 平台。我遇到的问题是flex-box 在移动应用程序上不能正常工作,但在网络应用程序上工作正常。我正在使用flex-direction: column,但它显示为row。有什么办法可以克服吗?

*,
*::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;
}

【问题讨论】:

    标签: html css email responsive-design


    【解决方案1】:

    虽然display:flex 对电子邮件客户端有很好的支持,但flex-direction:row 没有。因此,在您的示例中,flex-direction: column;align-items: center; 都将从 Outlook.com 或 iOS 和 Android 上的 Outlook 中删除,只剩下 display:flex 附带的默认值(对应于 flex-direction:rowalign-items:stretch )。

    我建议使用与电子邮件客户端更兼容的另一种布局方法,例如 display:inline-block 或表格。

    【讨论】:

      猜你喜欢
      • 2018-12-25
      • 1970-01-01
      • 1970-01-01
      • 2022-08-03
      • 2012-07-12
      • 2018-04-27
      • 2017-04-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多