I spotted this CSS code in a project:
html, body { :)width: 640px;}
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?
I spotted this CSS code in a project:
html, body { :)width: 640px;}
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?
It looks like a CSS hack to target IE7 and earlier browsers. While this is invalid CSS and browsers should ignore it, IE7 and earlier will parse and honor this rule. Here is an example of this hack in action:
CSS
IE8 (ignores the rule)
IE7 (applies the rule)
Note that it does not have to be a smiley face; BrowserHacks mentions:
The GAH hot dog stand example is here.
From an article at javascriptkit.com, that's applied for IE 7 and earlier versions:
Also there's a hack for <= IE 8:
However that's not a good idea, they don't validate. You always feel free to work with Conditional comments for targeting specific versions of IE:
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.The property used in the page is
:)font-size: 50px;
.