view raw
Nicasso Nicasso - 1 year ago 46
HTML Question

Backslash in CSS padding shorthand declaration

The website has a rule-set with two padding declarations which seem a bit strange. My question is, what does the

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;


"Backslash zero" is targeting IE8 for the current rule. This can be a terrible thing to do, unless there is no other choices.

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

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.