一篇技术论文详细记录了 CSS 发展历史中出现的各种非标准用法和浏览器特定 hack 1。文章通过具体代码示例和历史背景,梳理了 Internet Explorer 及其他早期浏览器在 CSS 解析和实现上的诸多问题,以及开发者为应对这些问题而采用的变通方案 1。
早期 Internet Explorer 版本存在多项影响 CSS 实现的缺陷。IE 7 及更早版本支持"星号 hack"(*width)来实现浏览器特定样式 1,同时错误地将任何"!"前缀的文本字符串视为 !important,如 !ie、!banana 等 1。IE 6 及更早版本则支持非标准的 cursor: hand 属性来实现手形光标,而非采用标准的 pointer 值 1。IE 5 引入的 CSS 表达式功能允许在 CSS 中执行 JavaScript 代码,但这一特性在 IE 8 中被移除 1。此外,IE 5.5 还引入了 scrollbar-face-color 等非标准属性来自定义滚动条外观 1。
开发者针对浏览器差异创造了多种创意解决方案。Box Model Hack 利用 voice-family 属性的解析错误来区分 IE 5 与标准浏览器 1,而 Holly Hack 则利用 IE for Mac 中注释转义处理的 bug 来实现浏览器检测 1。HTML Components(HTC)是 IE 5+ 独有功能,允许通过 CSS 将脚本逻辑附加到 HTML 元素 1。另外,供应商前缀最初用于测试实验性 CSS 特性,但因过度采用导致浏览器厂商无法移除支持 1。
A technical article has documented the various non-standard CSS practices, browser-specific hacks, and quirky behaviors that emerged during the early evolution of web standards.1 The piece uses concrete code examples and historical context to chronicle the numerous CSS parsing and implementation issues encountered in Internet Explorer and other early browsers, alongside the workarounds developers devised to address them.1
Among the documented peculiarities, Internet Explorer 7 and earlier versions relied on the "star hack" (*width) to apply browser-specific styles, while also treating any text string prefixed with "!" as equivalent to !important—including nonsensical variants like !ie and !banana.1 Internet Explorer 6 and earlier supported the non-standard cursor: hand property instead of the standard pointer value.1 More sophisticated approaches included the Box Model Hack, which exploited parsing errors in the voice-family property to differentiate Internet Explorer 5 from standards-compliant browsers, and the Holly Hack, which leveraged comment-escaping bugs in Internet Explorer for Mac to achieve browser detection.1
The article also traces the introduction of more complex features: CSS expressions, or Dynamic Properties, enabled JavaScript code execution directly within CSS in Internet Explorer 5 before being removed in IE 8, while Internet Explorer 5.5 introduced non-standard properties such as scrollbar-face-color to customize scrollbar appearance.1 HTML Components (HTC), an Internet Explorer 5+ exclusive, allowed developers to attach script logic to HTML elements via CSS.1 Additionally, vendor prefixes, initially intended for testing experimental CSS features, proliferated to the point where browser vendors became unable to remove support for them.1
评论
还没有评论,欢迎留下第一条。