From 991da9bf0975e595f7cc584cdf2ea6cb8a14b7ad Mon Sep 17 00:00:00 2001 From: Masahiro FUJIMOTO Date: Thu, 14 Oct 2021 00:57:05 +0900 Subject: CSS 変換の各ページの変換準備 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- files/ja/web/css/transform/index.md | 148 ++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 files/ja/web/css/transform/index.md (limited to 'files/ja/web/css/transform/index.md') diff --git a/files/ja/web/css/transform/index.md b/files/ja/web/css/transform/index.md new file mode 100644 index 0000000000..e5e505a742 --- /dev/null +++ b/files/ja/web/css/transform/index.md @@ -0,0 +1,148 @@ +--- +title: transform +slug: Web/CSS/transform +tags: + - CSS + - CSS プロパティ + - CSS 変形 + - Reference +translation_of: Web/CSS/transform +--- +{{CSSRef}} + +[CSS](/ja/docs/Web/CSS) のプロパティ **`transform`** は、与えられた要素を回転、拡大縮小、傾斜、移動することできます。これは、 CSS の[視覚整形モデル](/ja/docs/Web/CSS/Visual_formatting_model)の座標空間を変更します。 + +{{EmbedInteractiveExample("pages/css/transform.html")}} + + + +このプロパティに `none` 以外の値が設定されていると、[重ね合わせコンテキスト](/ja/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context) が作成されます。この場合、その要素はその中に含まれる `position: fixed;` または `position: absolute;` である要素すべての[包含ブロック](/ja/docs/Web/CSS/Containing_block)として扱われます。 + +
+変形可能な要素のみが `transform` の対象になります。つまり、レイアウトが CSS ボックスモデルによって管理される、[非置換インラインボックス](/ja/docs/Web/CSS/Visual_formatting_model#Inline-level_elements_and_inline_boxes)、[表の列ボックス](/ja/docs/Web/HTML/Element/col)、[表の列グループボックス](/ja/docs/Web/HTML/Element/colgroup)を除くすべての要素です。 +
+ +

構文

+ +
/* キーワード値 */
+transform: none;
+
+/* 関数値 */
+transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0);
+transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
+transform: perspective(17px);
+transform: rotate(0.5turn);
+transform: rotate3d(1, 2.0, 3.0, 10deg);
+transform: rotateX(10deg);
+transform: rotateY(10deg);
+transform: rotateZ(10deg);
+transform: translate(12px, 50%);
+transform: translate3d(12px, 50%, 3em);
+transform: translateX(2em);
+transform: translateY(3in);
+transform: translateZ(2px);
+transform: scale(2, 0.5);
+transform: scale3d(2.5, 1.2, 0.3);
+transform: scaleX(2);
+transform: scaleY(0.5);
+transform: scaleZ(0.3);
+transform: skew(30deg, 20deg);
+transform: skewX(30deg);
+transform: skewY(1.07rad);
+
+/* 複数の関数値 */
+transform: translateX(10px) rotate(10deg) translateY(5px);
+transform: perspective(500px) translate(10px, 0, 20px) rotateY(3deg);
+
+/* グローバル値 */
+transform: inherit;
+transform: initial;
+transform: unset;
+
+ +`transform` プロパティには、キーワード値 `[none](#none)` か `[<transform-function>](#<transform-function>)` の値のいずれかが指定されます。 + +

+ +
{{cssxref("<transform-function>")}}
+ - : 適用される 1 つ以上の [CSS 変形関数](/ja/docs/Web/CSS/transform-function)です。変形関数は、左から右へ順に重ねられ、つまり右から左の順に変形の混合の効果が適用されます。 +
`none`
+ - : 変形を何も適用しないことを指定します。 + +

形式文法

+ +{{csssyntax}} + +{{cssxref("transform-function/perspective", "perspective()")}} を複数の関数の中で使用する場合は、最初に配置しなければなりません。 + +

+ +

HTML

+ +
<div>Transformed element</div>
+ +

CSS

+ +
div {
+  border: solid red;
+  transform: translate(30px, 20px) rotate(20deg);
+  width: 140px;
+  height: 60px;
+}
+ +

結果

+ +{{EmbedLiveSample("Examples", "400", "160")}} + +その他の例は、[CSS Transforms の利用](/ja/docs/Web/Guide/CSS/Using_CSS_transforms) および {{cssxref("<transform-function>")}} をご覧ください。 + +

アクセシビリティの考慮事項

+ +拡大や縮小のアニメーションは、特定の種類の偏頭痛を引き起こす原因になりやすいので、アクセシビリティの問題になることがあります。ウェブサイトにこのようなアニメーションを含める必要がある場合は、できればサイト全体で、ユーザーがアニメーションを止める制御ができるようしてください。 + +また、 {{cssxref("@media/prefers-reduced-motion", "prefers-reduced-motion")}} メディア特性を使用することを検討してください。これを使用して[メディアクエリ](/ja/docs/Web/CSS/Media_Queries)を書けば、ユーザーがシステムの設定でアニメーションを減らすよう指定した場合にアニメーションを止めることができます。 + +詳しくは以下の文書を参照してください。 + + + +

仕様書

+ + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('CSS Transforms 2', '#transform-functions', 'transform')}}{{Spec2('CSS Transforms 2')}}3D 変換関数を追加。
{{SpecName('CSS3 Transforms', '#transform-property', 'transform')}}{{Spec2('CSS3 Transforms')}}初回定義
+ +{{cssinfo}} + +

ブラウザーの互換性

+ +{{Compat("css.properties.transform")}} + +## 関連情報 + + -- cgit v1.2.3-54-g00ecf