Detecting ‘transform: translate3d’ support

Check out this solution.

It is based on the fact that if a browser supports transforms, the value of


will be a string containing the transformation matrix, when a 3d transform is applied to the element el. Otherwise, it will be undefined or the string 'none', as in the case of Opera 12.02.

It works on all major browsers.

The code:

function has3d() {
    if (!window.getComputedStyle) {
        return false;

    var el = document.createElement('p'), 
        transforms = {

    // Add it to the body to get the computed style.
    document.body.insertBefore(el, null);

    for (var t in transforms) {
        if ([t] !== undefined) {
  [t] = "translate3d(1px,1px,1px)";
            has3d = window.getComputedStyle(el).getPropertyValue(transforms[t]);


    return (has3d !== undefined && has3d.length > 0 && has3d !== "none");

Leave a Comment