CSS Vendor Prefixes

By  on  

What are the Vendor Prefixes?

Vendor prefixes are small strings prepended to CSS properties that will ensure that the property will only be valid and rendered within the given browser engine.  Chrome and Safari both use the WebKit rendering engine, Firefox uses Gecko, Internet Explorer uses Trident, and Opera uses Presto.  Browser vendors generally don't implement other vendor prefixes but due to the popularity of the WebKit-based mobile browser, vendors like Opera and Firefox have also implemented WebKit's vendor prefixes on their mobile offerings.

Vendors use the following prefixes:

  • WebKit:  -webkit
  • Firefox:  -moz
  • Opera:  -o
  • Internet Explorer:  -ms

Why Vendor Prefixes?

There are a few reasons browser vendors use prefixes:

  • To implement proprietary CSS properties that have no working standard and may never become standard
  • To provide early implementations of standard properties
  • To provide an alternate syntax than the standard

Other reasons may apply but these are the main reasons.

Which Properties Use, or Have Used, Vendor Prefixes?

Prominent vendor-prefixed properties include:

  • @keyframes
  • transition and transform properties   (transition-property, transition-duration, transition-timing-function, transition-delay)
  • animation properties (animation-name, animation-duration, animation-timing-function, animation-delay)
  • border-radius
  • box-shadow
  • backface-visibility
  • column properties
  • flex properties
  • perspective properties

There have been and will be many more prefixed CSS properties!

How are Vendor Prefixes Used?

When using browser-prefixed properties, it's best to place the browser-prefixed properties first, then the standard property name and value.  For example:

/* use of keyframes */
@-webkit-keyframes fadeIn {
	0% { opacity: 0; } 100% { opacity: 0; }
}
@-moz-keyframes fadeIn {
	0% { opacity: 0; } 100% { opacity: 0; }
}
@keyframes fadeIn {
	0% { opacity: 0; } 100% { opacity: 0; }
}

/* use of basic properties */
.myClass {
	-webkit-animation-name: fadeIn;
	-moz-animation-name: fadeIn;
	animation-name: fadeIn;
}

If the standard is known, that rule is used; if unknown the rule is tossed out and the vendor-prefixed property is used!

Recent Features

  • By
    5 Ways that CSS and JavaScript Interact That You May Not Know About

    CSS and JavaScript:  the lines seemingly get blurred by each browser release.  They have always done a very different job but in the end they are both front-end technologies so they need do need to work closely.  We have our .js files and our .css, but...

  • By
    Introducing MooTools Templated

    One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating: new Element Madness The first way to create UI-driven...

Incredible Demos

  • By
    Build a Slick and Simple MooTools Accordion

    Last week I covered a smooth, subtle MooTools effect called Kwicks. Another great MooTools creation is the Accordion, which acts like...wait for it...an accordion! Now I've never been a huge Weird Al fan so this is as close to playing an accordion as...

  • By
    CSS @supports

    Feature detection via JavaScript is a client side best practice and for all the right reasons, but unfortunately that same functionality hasn't been available within CSS.  What we end up doing is repeating the same properties multiple times with each browser prefix.  Yuck.  Another thing we...

Discussion

  1. oh i hate those things
    can’t just every browser unite under one vendor prefix

    shoot !

  2. Kaylea

    Hi David!

    I used the flip card code on a project and I love it.

    There is a pronounced stutter in Firefox, chrome, Safari and ie even after I used the ie adapted code. Do you know why this could be happening? I cleared the cache and went through with a fine tooth comb.

    My other option would be to use a flip on click animation, but yours is easier in the long run. Thank you for your help.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!