Outlook 2016+中HTML签名的条件格式 [英] Conditional formatting for HTML Signatures in Outlook 2016+

查看:104
本文介绍了Outlook 2016+中HTML签名的条件格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我试图了解Outlook 2016及更高版本中HTML电子邮件签名中的条件格式.

So, I'm trying to understand the conditional formatting in HTML email signatures within Outlook 2016 and above.

我有这个简短的演示代码:

I have this short demo code:

<!DOCTYPE HTML>
<html>

<head>
</head>

<body>
    <!--[if mso]>
    <p  style="background: blue">
    <![endif]-->
    <p style="background: pink">TEST TEST TEST</p>
    <!--[if mso]>
    </p>
    <![endif]-->
</body>

</html>

根据我的逻辑,如果HTML是在Outlook 2016中呈现的,那应该将背景颜色更改为蓝色.

Which, by my logic, should change the background colour to blue, if the HTML is rendered within Outlook 2016.

但是,它是粉红色的.

我的代码在逻辑上是否不正确?还是条件语句一起出问题了?

Is my code incorrect logically? or is there something wrong with the conditional statement all together?

条件语句甚至在Outlook中仍然可以工作吗?

Do conditional statements even still work in Outlook?

因此,就将文本设置为蓝色而言,这似乎可行,但是我现在无法在其他地方将文本设置为绿色.

So, this seems to work, as far as setting the text blue, but I now can't get the text to be green elsewhere.

<!DOCTYPE HTML>
<html>

<head>
</head>

<body>
    <p style="background: pink">TEST TEST TEST</p>
    <!--[if mso]>
        <p  style="background: blue">
    <![endif]-->
    <!--[if !mso]>
        <p  style="background: green">
    <![endif]-->
        Test Test Test 2
    </p>
</body>

</html>

推荐答案

好的,因此条件必须位于它要更改的元素之内.

Ok, so the condition, needs to be within the element that it's trying to change.

<!DOCTYPE HTML>
<html>

<head>
</head>

<body>
    <p style="background: pink">
        <!--[if mso]>
            <p  style="background: blue">
        <![endif]-->
        Test Test Test
    </p>
</body>

</html>```

这篇关于Outlook 2016+中HTML签名的条件格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆