--- title: translateY() slug: Web/CSS/transform-function/translateY() tags: - CSS - CSS Function - CSS Transforms - Function - Reference translation_of: Web/CSS/transform-function/translateY() ---
translateX() は CSS のfunctionで、要素を二次元平面上の水平方向で再配置します。結果は {{cssxref("<transform-function>")}} データ型になります。

注: translateX(tx) は translate(tx, 0) または translate3d(tx, 0, 0) と等価です。
/* <length-percentage> values */ transform: translateX(200px); transform: translateX(50%);
<length-percentage>| ℝ2 のデカルト座標 | ℝℙ2 の同次座標 | ℝ3 のデカルト座標 | ℝℙ3 の同次座標 |
|---|---|---|---|
|
ℝ2 では線形変換ではないので、デカルト座標の行列で表すことはできない。 |
|||
[1 0 0 1 t 0] |
<div>Static</div> <div class="moved">Moved</div> <div>Static</div>
div {
width: 60px;
height: 60px;
background-color: skyblue;
}
.moved {
transform: translateX(10px); /* translate(10px) と等価 */
background-color: pink;
}
{{EmbedLiveSample("Examples", 250, 250)}}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName("CSS3 Transforms", "#funcdef-transform-translatex", "translateX()")}} | {{Spec2("CSS3 Transforms")}} | 初回定義 |
<transform-function> データ型の互換性情報をご覧ください。