css - IE9 怪癖模式下 css ID 开头的下划线未注册

标签 css internet-explorer-9 quirks-mode

我有一个动态加载的 CSS 文件,其中包含一个 ID 如下的 css 行:

#__my_css_id{

   width: 100%;
   height: 100%;
   left: 0px;
   top: 0px;
   position: fixed;
   background-color: #202020;
}

我不能改变这个页面以怪异模式呈现的事实,因为它是一个远程托管脚本(我的脚本就是)。有些页面很奇怪,有些则不是。

当处于怪癖模式和 IE9(未尝试其他 IE 版本)时,css 似乎无法正确加载或根本无法加载。事实上,如果我使用 IE 调试器 (F12) 调试 css,那么我会看到所有的 CSS,但所有的 css IDS 都说 UNKNOWN 如果它们以这样的两个下划线开头 #__

如果我调试元素并检查 css,则没有任何 css 规则。怪癖模式是否不允许在 css ID 开头使用下划线?

谢谢!

最佳答案

双下划线适用于 CSS2,但 quirks mode是 CSS1 的部分实现。 CSS2 spec说:

In CSS2, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B\26 W\3F".

虽然下划线在CSS1中是无效字符:

In CSS1, selectors (element names, classes and IDs) can contain only the characters A-Z, 0-9, and Unicode characters 161-255, plus dash (-); they cannot start with a dash or a digit; they can also contain escaped characters and any Unicode character as a numeric code (see next item).

关于css - IE9 怪癖模式下 css ID 开头的下划线未注册,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6326544/

相关文章:

javascript - ASPX 页面上的 C# 值在刷新时合并

html - 需要有关 Internet Explorer 9 显示问题的帮助

javascript - 在 Internet Explorer 9 中禁用 F5

css - 在 IE 怪癖模式下垂直对齐 li 标签内的多行文本

internet-explorer - 位置 : absolute to be absolute to the browser/window

jQuery:操纵 CSS

html - 表行上的 z 索引不起作用

html - 在 :after with inset border radius 中创建箭头

javascript - Ajax.Request 不适用于 IE8/9 中的 CORS,静默失败

html - 如何让盒子根据其内容增加其大小?