Arjun
Arjun

Reputation: 1355

Why do developers write CSS animation rule without prefix?

I wanted to ask that as every browser has its prefix for animation then why developers write a property without any prefix. Look at this example taken from w3schools.com:

div {
    -ms-transform: scale(0.5,0.5); /* IE 9 */
    -webkit-transform: scale(0.5,0.5); /* Safari */
    transform: scale(0.5,0.5);
}

Why does the second last line exist?

Upvotes: 0

Views: 113

Answers (2)

twekz
twekz

Reputation: 82

Maybe I'm off topic, but I would argue that many projects nowadays use CSS preprocessors and/or some kind of building tool (like webpack, gulp or CodeKit) to compile development CSS into production-ready code.

All these task managers allow you to write your code without thinking about vendor prefixes, and delegate most of the browser support headaches to plugins like autoprefixer.

Upvotes: 0

Not Superman
Not Superman

Reputation: 116

So not every modern browser requires prefixes. Infact the CSS community want to move away from them as a general consensus, as they are essentially a reminiscent of the browser wars. In some use cases, they can be helpful. Your example allows support for IE9, whereas IE10+ wont require this prefix.

Some developers don't want to support legacy browsers, some do. It's that simple. All depends on your needs.

Upvotes: 5

Related Questions