I needed this recently for IE7 and 8, and decided to deal with the inconvenience of calculating IE-specific values ββand offsets by writing a small piece of JavaScript.
Ideas and explanations for the script come from these links:
http://www.boogdesign.com/examples/transforms/matrix-calculator.html
http://extremelysatisfactorytotalitarianism.com/blog/?p=1002
And here is the script (I run it using node, but you can also skip it in your browser console):
// --- initialization var w = 712; // object width var h = 744; // object height var deg = 48; // object rotation in degrees // --- utils function deg2rad(deg) { return deg * (2 * Math.PI) / 360; } var rad = deg2rad(deg); // --- from http://www.boogdesign.com/examples/transforms/matrix-calculator.html var costheta = Math.cos(rad); var sintheta = Math.sin(rad); var a = parseFloat(costheta).toFixed(8); var c = parseFloat(-sintheta).toFixed(8); var b = parseFloat(sintheta).toFixed(8); var d = parseFloat(costheta).toFixed(8); console.log('-ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=' + a + ', M12=' + c + ', M21=' + b + ', M22=' + d + ', sizingMethod=\'auto expand\')";'); console.log('filter: progid:DXImageTransform.Microsoft.Matrix(M11=' + a + ', M12=' + c + ', M21=' + b + ', M22=' + d + ', sizingMethod=\'auto expand\');'); // --- from http://extremelysatisfactorytotalitarianism.com/blog/?p=1002 // calculate bounding box width and height var bb_w = Math.abs(h * Math.sin(rad)) + Math.abs(w * Math.cos(rad)); var bb_h = Math.abs(h * Math.cos(rad)) + Math.abs(w * Math.sin(rad)); // calculate offsets var offset_left = Math.floor((w / 2) - (bb_w / 2)); var offset_top = Math.floor((h / 2) - (bb_h / 2)); console.log('left: ' + offset_left + 'px;'); console.log('top: ' + offset_top + 'px;');
source share