Nicasso Nicasso - 2 years ago 118
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;

Answer Source

"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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download