--- title: translate3d() slug: Web/CSS/transform-function/translate3d tags: - CSS - CSS Funktion - CSS Transformation - Funktion - Referenz translation_of: Web/CSS/transform-function/translate3d() original_slug: Web/CSS/transform-function/translate3d() ---
Die CSS-Eigenschaften translate3d()
positioniert ein Element im 3D-Raum neu. Sein Ergebnis ist ein {{cssxref("<Transform-Funktion>")}} Datentyp.
Die Quelle für dieses interaktive Beispiel ist in einem GitHub-Repository gespeichert. Wenn Sie zum Projekt der interaktiven Beispiele beitragen möchten, klonen Sie bitte https://github.com/mdn/interactive-examples und senden Sie uns eine Pull-Anfrage.
Diese Transformation wird durch einen dreidimensionalen Vektor charakterisiert. Seine Koordinaten legen fest, wie sehr sich das Element in jede Richtung bewegt.
translate3d(tx, ty, tz)
tx
ty
tz
Kartesische Koordinaten auf ℝ2 | Homogene Koordinaten auf ℝℙ2 | Kartesische Koordinaten auf ℝ3 | Homogene Koordinaten auf ℝℙ3 |
---|---|---|---|
Diese Transformation gilt für den 3D-Raum und kann nicht in der Ebene dargestellt werden. |
Eine Verschiebung ist keine lineare Transformation in ℝ3 und kann nicht durch eine kartesische Koordinatenmatrix dargestellt werden. |
<div>Static</div> <div class="moved">Moved</div> <div>Static</div>
div { width: 60px; height: 60px; background-color: skyblue; } .moved { /* Equivalent to perspective(500px) translateX(10px) */ transform: perspective(500px) translate3d(10px, 0, 0px); background-color: pink; }
{{EmbedLiveSample("Using_a_single_axis_translation", 250, 250)}}
<div>Static</div> <div class="moved">Moved</div> <div>Static</div>
div { width: 60px; height: 60px; background-color: skyblue; } .moved { transform: perspective(500px) translate3d(10px, 0, 100px); background-color: pink; }
{{EmbedLiveSample("Combining_z-axis_and_x-axis_translation", 250, 250)}}
Spezifikation | Status | Kommentar |
---|---|---|
{{SpecName("CSS Transforms 2", "#funcdef-translate3d", "translate3d()")}} | {{Spec2("CSS Transforms 2")}} | Ursprüngliche Definition |
{{Compat("css.types.transform-function")}}
translateY()
translateX()