什么是笑脸“:)”是什么意思在CSS? [英] What does the smiley face ":)" mean in CSS?
问题描述
我在一个项目中发现了这个CSS代码:
I spotted this CSS code in a project:
html, body { :)width: 640px;}
我已经使用CSS很长时间了,但我从来没有看到这个:)代码。
I have been around with CSS for a long time now but I never saw this ":)" code before. Does it mean anything or is it just a typo?
推荐答案
从在javascriptkit.com 上的文章,适用于 IE 7 和早期版本:
From an article at javascriptkit.com, that's applied for IE 7 and earlier versions:
如果您在属性名称前添加一个非字母数字字符,例如星号(
*
),该属性将应用于IE和
if you add a non-alphanumeric character such as an asterisk (
*
) immediately before a property name, the property will be applied in IE and not in other browsers.
此外,还有< = IE 8
Also there's a hack for <= IE 8:
div {
color: blue; /* All browsers */
color: purple\9; /* IE8 and earlier */
*color: pink; /* IE7 and earlier */
}
然而,这不是一个好主意,验证。您随时都可以使用 条件注释 来定位特定版本 IE ::
However that's not a good idea, they don't validate. You are always free to work with Conditional comments for targeting specific versions of IE:
<!--[if lte IE 8]><link rel="stylesheet" href="ie-8.css"><![endif]-->
<!--[if lte IE 7]><link rel="stylesheet" href="ie-7.css"><![endif]-->
<!--[if lte IE 6]><link rel="stylesheet" href="ie-6.css"><![endif]-->
但是对于那些想看到实际的黑客,请打开此页面在您的最新版本的IE。然后通过执行 F12 进入开发人员模式。在仿真部分( ctrl + 8 )将文档模式更改为 7
,看看会发生什么。
But for those wanna see the hack in real, please open up this page in the latest version of IE you have. Then go to developer mode by doing a F12. In Emulation section (ctrl+8) change document mode to 7
and see what happens.
页面中使用的属性是 :) font-size:50px;
。
这篇关于什么是笑脸“:)”是什么意思在CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!