在CSS前面三重期 [英] Triple Periods in front of CSS

查看:112
本文介绍了在CSS前面三重期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是pretty怪异,我收到一个邮件对CSS的定义如下:

This is pretty weird, a mail I received has the following definitions for the css:

<style type="text/css">
...NL-default {
    font-family: "Arial";
    font-size: 12px;
    color: #000000;
}
...style1 {
    font-family: "Arial";
    font-size: 12px;
    color: #0000FF;
}
...style4 {
    text-align: center;
    background-color: #F3F3F3;
    font-family: "Arial";
    font-size: 12px;
    color: #000000;
}
...style7 {
    text-align: center;
    color: #FFFFFF;
    background-color: #000080;
    font-family: "Arial";
    font-size: 12px;
    font-weight: bold;
}
...style14 {
    font-family: "Arial";
    font-size: 14px;
    color: #FF3300;
    font-weight: bold;
}

基本上所有的款式都在他们前面三段。

Basically all styles have triple periods in front of them.

和它在一个问题应用,像这样:

And it's applied in a matter like so:

    <table style="width: 100%;" class="style41" cellSpacing="1" cellPadding="3">

        <tbody><tr>
            <td style="width: 233px;" class="style34" strong=""><strong>Notification</strong></td>

我相信大多数人的第一直觉可能..这不会工作,你是对的。在Chrome,火狐和IE9的CSS是不是在所有的应用到邮件正文。

I believe most peoples' first intuition might be.. this won't work and you'd be right. On Chrome, Firefox and IE9, the CSS isn't applied to the mail body at all.

不过,IE8,它被完全应用了迷惑了我不少。什么是把三段在你的CSS定义前的目的是什么?为什么只有在IE8做这项工作?

However, on IE8, it gets applied perfectly which bewilders me quite a bit. What's the purpose of putting triple periods in front of your CSS definitions? Why does this work only on IE8?

推荐答案

IE被称为治疗类选择领先的点作为一个普通类选择,就像<一个href=\"http://stackoverflow.com/questions/10124254/css-rule-drop-a-being-applied-to-class-drag-a/10124317#10124317\">it把多类选择,因为只有最后一个链,怪癖模式。

IE is known to treat leading dots in class selectors as a regular class selector, much like it treats multiple class selectors as only the last in the chain, in quirks mode.

这是说......这似乎是一个非常丑陋的黑客。我甚至不能确定它的目的是为IE浏览器的黑客,因为code看起来并不像它的目的只为IE浏览器使用。在这种情况下,我不知道真正的目的是增加导致周期以邮件方式像什么。

That said... this seems like a really ugly hack. I'm not even sure that it was intended as an IE hack, because the code doesn't look like it was intended only for IE to use. In that case, I don't know what the real purpose is of adding leading periods to the mail styles like that.

另外,我不知道为什么code不会在IE9工作,即使不是在怪癖模式。下面的测试案例绝对让文红在所有版本的IE直至并包括9:

Also, I'm not sure why the code wouldn't work in IE9, not even in quirks mode. The following test case definitely makes the text red in all IE versions up to and including 9:

<html>
  <head>
    <style type="text/css">
    ...foo {
        color: #FF0000;
    }
    </style>
  </head>
  <body>
    <p class="foo">This text should not be red.</p>
  </body>
</html>

正如你可能已经猜到了,这不是有效的CSS。这就是为什么它不能在其他浏览器,甚至在自己的怪癖模式。

As you may have guessed, this isn't valid CSS. That's why it doesn't work in other browsers, not even in their quirks modes.

这篇关于在CSS前面三重期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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