3

The website Qq.com has a rule-set with two padding declarations which seem a bit strange. My question is, what does the 11px\0 part do? Does this have something to do with overriding the first padding declaration? I understand the use of the slash in situations like these: / (forward slash) in css style declarations, but I have never seen something like this.

.suggestion .s_title {
padding: 3px 0 1px 11px;
padding: 4px 0 1px 11px\0;
color: #a0a3a8;
font-size: 12px;
line-height: 18px;
}
Community
  • 1
  • 1
Nicasso
  • 265
  • 1
  • 7
  • 2
    Seems to me like some IE specific hack. (*Edit*: For IE8 - http://stackoverflow.com/questions/5635829/ie8-css-hack-best-method) – Harry May 04 '16 at 07:34

2 Answers2

4

"Backslash zero" is a css hack targeting IE8 for the current rule. This can be a terrible thing to do, unless there is no other choices. What happens is that IE8 will erroneously believe that this is a valid rule to be applied while other browsers won't, leaving you with a chaos rule:

.my-dirty-rule-for-ie-8-only { margin-bottom: 5px\0; }

For this ruleset, that means the second padding will take effect by overriding the first one only if the user displays your page with IE8.

From a developper point of view, css hacks should be avoided at all cost. You seriously never want to deal with rules targeting a specific browser, as it will haunt you forever from the moment you fall for it.

Frederik.L
  • 5,522
  • 2
  • 29
  • 41
0

As Harry pointed out, it was a IE specific hack. You use the \0 part to specify the declaration for a specific IE version. More information about it here:

http://codemug.com/html/css-hacks-for-ie6ie7ie8ie9-and-ie10/ And here http://mynthon.net/howto/-/webdev/CSS-big-list-of-css-hacks.txt (See: 24. IE9 hack)

Nicasso
  • 265
  • 1
  • 7