transform

  • Revision slug: CSS/transform
  • Revision title: transform
  • Revision id: 21709
  • Created:
  • Creator: MatrixFrog
  • Is current revision? No
  • Comment no changes

Revision Content

{{ CSSMozExtensionRef() }}{{ gecko_minversion_header("1.9.1") }}

Summary

The -moz-transform CSS property lets you modify the coordinate space of the CSS visual formatting model.  Using it, elements can be translated, rotated, scaled, and skewed as this text.

  • {{ Xref_cssinitial() }}: none
  • Applies to: all block level and inline level elements
  • {{ Xref_cssinherited() }}: no
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}:

Syntax

 -moz-transform:  <transform-function> [<transform-function>]* | none

Values

transform-function
One or more of the {{ anch("CSS transform functions") }} to be applied, see below.
none
Specifies that no transform should be applied.

Examples

See Using CSS transforms.

Live Example

pre {
     width: 33em;
     border: solid red;

    -moz-transform: translate(100px) rotate(40deg);
    -moz-transform-origin: 60% 100%;

    -webkit-transform: translate(100px) rotate(40deg);
    -webkit-transform-origin: 60% 100%;

    -o-transform:translate(100px) rotate(40deg); 
    -o-transform-origin:60% 100%;
}

CSS transform functions

The -moz-transform CSS property allows the coordinate system used by an element to be manipulated using transform functions. These functions are described below.

matrix

-moz-transform:  matrix(a, c, b, d, tx, ty)

/* Where a, b, c, d build the transformation matrix 
   ┌     ┐ 
   │ a b │
   │ c d │
   └     ┘
   and tx, ty are the translate values.  */

Specifies a 2D transformation matrix comprised of the specified six values.  This is the equivalent to applying the transformation matrix [a b c d tx ty].

Note:  Gecko (Firefox) accepts a {{ Xref_csslength() }} value for tx and ty.
Safari (WebKit) and Opera currently support a unitless {{ Xref_cssnumber() }} for tx and ty.

Live Examples

 background: gold;  width: 30em;

    -moz-transform: matrix(1, -0.2, 0, 1, 0, 0);
 -webkit-transform: matrix(1, -0.2, 0, 1, 0, 0);
       -o-transform:matrix(1, -0.2, 0, 1, 0, 0);
 background: wheat;
 max-width: intrinsic;  max-width: -moz-fit-content;

    -moz-transform: matrix(1, 0, 0.6, 1, 15em, 0);
 -webkit-transform: matrix(1, 0, 0.6, 1,  250, 0);
      -o-transform: matrix(1, 0, 0.6, 1,  250, 0);

See also

rotate

-moz-transform:  rotate(angle);      /* an {{ Xref_cssangle() }}, e.g.  rotate(30deg) */

Rotates the element clockwise around its origin (as specified by the {{ Cssxref("-moz-transform-origin") }} property) by the specified angle.  The operation corresponds to the matrix [cos(angle) sin(angle) -sin(angle) cos(angle) 0 0].

scale

-moz-transform:  scale(sx[, sy]);     /* one or two unitless {{ Xref_cssnumber() }}s, e.g.  scale(2.1,4) */

Specifies a 2D scaling operation described by [sx, sy].  If sy isn't specified, it is assumed to be equal to sx.

scaleX

-moz-transform:  scaleX(sx);          /* a unitless {{ Xref_cssnumber() }}, e.g.  scaleX(2.7) */

Specifies a scale operation using the vector [sx, 1].

scaleY

-moz-transform:  scaleY(sy)           /* a unitless {{ Xref_cssnumber() }}, e.g.  scaleY(0.3) */

Specifies a scale operation using the vector [1, sy].

skew

-moz-transform:  skew(ax[, ay])       /* one or two {{ Xref_cssangle() }}, e.g.  skew(30deg,-10deg) */

Skews the element around the X and Y axes by the specified angles.  If ay isn't provided, no skew is performed on the Y axis.

skewX

-moz-transform:  skewX(angle)         /* an {{ Xref_cssangle() }}, e.g.  skewX(-30deg) */

Skews the element around the X axis by the given angle.

skewY

-moz-transform:  skewY(angle)         /* an {{ Xref_cssangle() }}, e.g.  skewY(4deg) */

Skews the element around the Y axis by the given angle.

translate

-moz-transform:  translate(tx[, ty])  /* one or two {{ Xref_csslength() }} values */

Specifies a 2D translation by the vector [tx, ty].  If ty isn't specified, its value is assumed to be zero.

translateX

-moz-transform:  translateX(tx)       /* see {{ Xref_csslength() }} for possible values */

Translates the element by the given amount along the X axis.

translateY

-moz-transform:  translateY(ty)       /* see {{ Xref_csslength() }} for possible values */

Translates the element by the given amount along the Y axis.

Browser compatibility

Browser Lowest version  Support of
Internet Explorer --- ---
5.5 Microsoft's Matrix Filter
Firefox (Gecko) 3.5 (1.9.1) -moz-transform
Opera 10.5 -o-transform
Safari (WebKit) 3.1 (525) -webkit-transform

Specifications

See also

{{ cssxref("-moz-transform-origin") }}, Using CSS transforms

{{ languages( { "ja": "ja/CSS/-moz-transform" } ) }}

Revision Source

<p>{{ CSSMozExtensionRef() }}{{ gecko_minversion_header("1.9.1") }}</p>
<h2>Summary</h2>
<p>The<code> -moz-transform </code>CSS property lets you modify the coordinate space of the CSS visual formatting model.  Using it, elements can be translated, rotated, scaled, and skewed as this text.</p>
<ul> <li>{{ Xref_cssinitial() }}: none</li> <li>Applies to: all block level and inline level elements</li> <li>{{ Xref_cssinherited() }}: no</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}:</li>
</ul>
<h2>Syntax</h2>
<pre> -moz-transform:  &lt;transform-function&gt; [&lt;transform-function&gt;]* | none
</pre>
<h2>Values</h2>
<dl> <dt>transform-function</dt> <dd>One or more of the {{ anch("CSS transform functions") }} to be applied, see below.</dd> <dt>none</dt> <dd>Specifies that no transform should be applied.</dd>
</dl>
<h2>Examples</h2>
<p>See <a class="internal" href="/En/CSS/Using_CSS_transforms" title="/en/CSS/Using CSS transforms">Using CSS transforms</a>.</p>
<h4>Live Example</h4>
<pre style="width:33em; border:solid red; -moz-transform:translate(100px) rotate(40deg); -moz-transform-origin:60% 100%; -webkit-transform:translate(100px) rotate(40deg); -webkit-transform-origin:60% 100%; -o-transform:translate(100px) rotate(40deg); -o-transform-origin:60% 100%;">pre {
     width: 33em;
     border: solid red;

    -moz-transform: translate(100px) rotate(40deg);
    -moz-transform-origin: 60% 100%;

    -webkit-transform: translate(100px) rotate(40deg);
    -webkit-transform-origin: 60% 100%;

    -o-transform:translate(100px) rotate(40deg); 
    -o-transform-origin:60% 100%;
}
</pre>
<h2>CSS transform functions</h2>
<p>The<code> -moz-transform </code>CSS property allows the coordinate system used by an element to be manipulated using <strong>transform functions</strong>. These functions are described below.</p>
<h3>matrix</h3>
<pre>-moz-transform:  matrix(a, c, b, d, tx, ty)

/* Where a, b, c, d build the transformation matrix 
   ┌     ┐ 
   │ a b │
   │ c d │
   └     ┘
   and tx, ty are the translate values.  */
</pre>
<p>Specifies a 2D transformation matrix comprised of the specified six values.  This is the equivalent to applying the transformation <strong>matrix [a b c d tx ty]</strong>.</p>
<div class="note"><strong>Note:</strong>  Gecko (Firefox) accepts a {{ Xref_csslength() }} value for <strong>tx</strong> and <strong>ty</strong>.<br>
Safari (WebKit) and Opera currently support a unitless {{ Xref_cssnumber() }} for <strong>tx</strong> and <strong>ty</strong>.</div>
<h4>Live Examples</h4>
<pre style="background:gold; width:400px; -moz-transform:matrix(1, -0.2, 0, 1, 0, 0);  -webkit-transform:matrix(1, -0.2, 0, 1, 0, 0); -o-transform:matrix(1, -0.2, 0, 1, 0, 0); "> background: gold;  width: 30em;

    -moz-transform: matrix(1, -0.2, 0, 1, 0, 0);
 -webkit-transform: matrix(1, -0.2, 0, 1, 0, 0);
       -o-transform:matrix(1, -0.2, 0, 1, 0, 0);
</pre>
<pre style="background:wheat; max-width:intrinsic; max-width:-moz-fit-content; -moz-transform: matrix(1, 0, 0.6, 1, 15em, 0); -webkit-transform: matrix(1, 0, 0.6, 1, 250, 0); -o-transform: matrix(1, 0, 0.6, 1, 250, 0)"> background: wheat;
 max-width: intrinsic;  max-width: -moz-fit-content;

    -moz-transform: matrix(1, 0, 0.6, 1, 15em, 0);
 -webkit-transform: matrix(1, 0, 0.6, 1,  250, 0);
      -o-transform: matrix(1, 0, 0.6, 1,  250, 0);
</pre>
<h4>See also</h4>
<ul> <li><a class="external" href="http://en.wikipedia.org/wiki/Linear_transformation#Examples_of_linear_transformation_matrices" title="http://en.wikipedia.org/wiki/Linear_transformation#Examples_of_linear_transformation_matrices">Examples of linear transformation matrices</a> Wikipedia</li> <li><a class="external" href="http://www.mathamazement.com/Lessons/Pre-Calculus/08_Matrices-and-Determinants/coordinate-transformation-matrices.html" title="http://www.mathamazement.com/Lessons/Pre-Calculus/08_Matrices-and-Determinants/coordinate-transformation-matrices.html">Coordinate transformation matrices</a> mathamazement.com</li> <li><a class=" external" href="http://msdn.microsoft.com/en-us/library/ms533014(VS.85,loband).aspx">Microsoft's matrix filter</a> MSDN</li>
</ul>
<h3>rotate</h3>
<pre class="eval">-moz-transform:  rotate(angle);      /* an {{ Xref_cssangle() }}, e.g.  rotate(30deg) */</pre>
<p>Rotates the element clockwise around its origin (as specified by the {{ Cssxref("-moz-transform-origin") }} property) by the specified <code>angle</code>.  The operation corresponds to the matrix <strong>[cos(angle) sin(angle) -sin(angle) cos(angle) 0 0]</strong>.</p><h3>scale</h3>
<pre class="eval">-moz-transform:  scale(sx[, sy]);     /* one or two unitless {{ Xref_cssnumber() }}s, e.g.  scale(2.1,4) */</pre>
<p>Specifies a 2D scaling operation described by <strong>[sx, sy]</strong>.  If <code>sy</code> isn't specified, it is assumed to be equal to <code>sx</code>.</p>
<h3>scaleX</h3>
<pre class="eval">-moz-transform:  scaleX(sx);          /* a unitless {{ Xref_cssnumber() }}, e.g.  scaleX(2.7) */</pre>
<p>Specifies a scale operation using the vector <strong>[sx, 1]</strong>.</p>
<h3>scaleY</h3>
<pre class="eval">-moz-transform:  scaleY(sy)           /* a unitless {{ Xref_cssnumber() }}, e.g.  scaleY(0.3) */</pre>
<p>Specifies a scale operation using the vector <strong>[1, sy]</strong>.</p>
<h3>skew</h3>
<pre class="eval">-moz-transform:  skew(ax[, ay])       /* one or two {{ Xref_cssangle() }}, e.g.  skew(30deg,-10deg) */</pre>
<p>Skews the element around the X and Y axes by the specified angles.  If <code>ay</code> isn't provided, no skew is performed on the Y axis.</p>
<h3>skewX</h3>
<pre class="eval">-moz-transform:  skewX(angle)         /* an {{ Xref_cssangle() }}, e.g.  skewX(-30deg) */</pre>
<p>Skews the element around the X axis by the given <code>angle</code>.</p>
<h3>skewY</h3>
<pre class="eval">-moz-transform:  skewY(angle)         /* an {{ Xref_cssangle() }}, e.g.  skewY(4deg) */</pre>
<p>Skews the element around the Y axis by the given <code>angle</code>.</p>
<h3>translate</h3>
<pre class="eval">-moz-transform:  translate(tx[, ty])  /* one or two {{ Xref_csslength() }} values */</pre>
<p>Specifies a 2D translation by the vector <strong>[tx, ty]</strong>.  If <code>ty</code> isn't specified, its value is assumed to be zero.</p>
<h3>translateX</h3>
<pre class="eval">-moz-transform:  translateX(tx)       /* see {{ Xref_csslength() }} for possible values */</pre>
<p>Translates the element by the given amount along the X axis.</p>
<h3>translateY</h3>
<pre class="eval">-moz-transform:  translateY(ty)       /* see {{ Xref_csslength() }} for possible values */</pre>
<p>Translates the element by the given amount along the Y axis.</p>
<h2>Browser compatibility</h2>
<table class="standard-table"> <tbody> <tr> <th>Browser</th> <th>Lowest version</th> <th> Support of</th> </tr> <tr> <td rowspan="2">Internet Explorer</td> <td>---</td> <td>---</td> </tr> <tr> <td>5.5</td> <td>Microsoft's <a class="external" href="http://msdn.microsoft.com/en-us/library/ms533014(VS.85,loband).aspx" title="http://msdn.microsoft.com/en-us/library/ms533014(VS.85,loband).aspx">Matrix Filter</a></td> </tr> <tr> <td>Firefox (Gecko)</td> <td>3.5 (1.9.1)</td> <td><code>-moz-transform</code></td> </tr> <tr> <td>Opera</td> <td>10.5</td> <td><code>-o-transform</code></td> </tr> <tr> <td>Safari (WebKit)</td> <td>3.1 (525)</td> <td><code>-webkit-transform</code></td> </tr> </tbody>
</table>
<h2>Specifications</h2>
<ul> <li><a class="external" href="http://www.w3.org/TR/css3-2d-transforms/" title="http://www.w3.org/TR/css3-2d-transforms/">CSS3 2D Transforms</a> Working draft</li>
</ul>
<h2>See also</h2>
<p>{{ cssxref("-moz-transform-origin") }}, <a class="internal" href="/en/CSS/Using_CSS_transforms" rel="internal" title="/en/CSS/Using CSS transforms">Using CSS transforms</a></p>
<p>{{ languages( { "ja": "ja/CSS/-moz-transform" } ) }}</p>
Revert to this revision