For example what does the -- in this style mean?

li  {
    --background:url(imags/li-sbg.gif) no-repeat left bottom;
}

3 answers

grenade 50
6
points
This was chosen as the best answer

It's an IE6 (or older IE) hack. Valid CSS properties may not start with a hyphen or underscore so declarations that use them will be ignored by conforming browsers.

See http://brainfart.com.ua/post/css-hacks-overview/ (point 8) for a reference.

IE6 will process the property as if it is valid CSS so the hack is used when a behaviour or styling is wanted in IE6 only.

Answered about 7 years ago by grenade
  • If I could double-plus I'd give another +1 for the pointer to the CSS Hacks page with all the stuff we have to do (for IE mostly) to make CSS behave in all browsers. Jim Sewell about 7 years ago
  • Agreed. That IE hacks link is wonderful, and especially relevant today, when we're increasingly moving away from proper support for IE6 and below. Peter Organisciak about 7 years ago
  • its funny, that's one hack I've never come accross before... danwellman about 7 years ago
danwellman 5600
1
point

It means there's an error in your stylesheet ;)

the background will not be set as the -- will not be recognised by the browser

Answered about 7 years ago by danwellman
  • Thanks. I thought it might be a browser hack. Jonathan Parker about 7 years ago
0
points

The original author may be using a trick to disable CSS declarations without commenting them out or removing them.

While it's a bit of a hack, it helps with readability of code and allows you to quickly dis/enable styles. You can also script the removal of such invalid styles by using regular expressions in a CSS minifier.

Answered about 7 years ago by James Spencer