【问题标题】:backslash in CSS min-height property [duplicate]CSS min-height 属性中的反斜杠 [重复]
【发布时间】:2013-10-15 02:16:57
【问题描述】:

您好,我遇到了以下代码:.height480{ min-height:484px; min-height:497px\9;} 我以前从未见过反斜杠。我已经检查了 W3c 文档中的 min-height 并且没有提及它。有人知道吗?我注意到firefox忽略了它,所以猜它可能只是一个错字?干杯露水

【问题讨论】:

  • @BoltClock。感谢您将此识别为骗局。谷歌搜索 css \ 没有提出欺骗问题,在我写问题时也没有提出答案建议。当时,我并没有意识到数字 9 的意义。css 中的大多数数字都是任意的。

标签: css


【解决方案1】:

这是一个 IE 黑客

第一个min-height适用于其他浏览器,下一个min-height with slash适用于IE7、IE8和IE9

see this site

.header {width:300px;height:200px;background:#000;} /* Applies to all browsers */
*.header {width:310px;height:200px;background:#000;} /* Applies to all IE browsers */
_.header {width:290px;height:200px;background:#000;} /* Applies to all IE browsers 6 and below */
.header {width /*\**/:330px\9;height:200px;background:#000;} /* Applies to IE 8 */
(Note: IE 8 and IE9 are a diffent animals, it is tying to act like web-kit. A tip of the hat to Safari and Crome.)

【讨论】:

  • 您能具体说明一下 \9 的作用吗?它是否说明适用于早于IE9?如 \8 会早于 IE8?还是我误会了?