transition-property
『transition』でのアニメーション効果を適用させたいプロパティを個別に指定できます。
ブラウザのバージョンによっては、ベンダープレフィックス『webkit』、『moz』、『ms』等を付けないと動かない場合があるので、使用する際はベンダープレフィックスを付けるようにした方が無難です。またPCのスペックによっては動きがカクついてしまう場合がありますのでご注意下さい。
サンプルコード
transition: 0.5s; -webkit-transition: 0.5s; -moz-transition: 0.5s; -ms-transition: 0.5s; transition-property: width; -webkit-transition-property: width; -moz-transition-property: width; -ms-transition-property: width;
ブラウザでの表示結果
div {
background :#f00;
width: 200px;
transition: 0.5s;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
-ms-transition: 0.5s;
transition-property: width;
-webkit-transition-property: width;
-moz-transition-property: width;
-ms-transition-property: width;
}
div:hover{
width: 300px;
background: #ff0;
}
対応ブラウザ
デスクトップ
25 △
24 △
23 △
22 △
21 △
20 △
19 △
18 △↑ prefix『-webkit-』が必要
15 △
14 △
13 △
12 △
11 △
10 △
9 △
8 △↑ prefix『-moz-』が必要
3 以前 ×
7 △
6 △
5 △
4 △↑ prefix『-webkit-』が必要
2 以前 ×全バージョンで対応しています
8 ×
7 ×
6 ×
10 以前 ×モバイル
7 △
6 △
5 △
4 △
3 △
2 △↑ prefix『-webkit-』が必要
1 以前 ×
Android Browser
4.4 以降 ○
3 以前 ×デスクトップ版と同等の対応です
デスクトップ版と同等の対応です
概要
『transition』でのアニメーション効果を適用させたいプロパティを個別に指定できます。
『transition-property』の値は『,』で区切ることにより複数のプロパティを同時に指定できます。
div {
background :#f00;
width: 200px;
height: 50px;
transition: 0.5s;
-webkit-transition: 0.5s;
-moz-transition: 0.5s;
-ms-transition: 0.5s;
transition-property: width, height;
-webkit-transition-property: width, height;
-moz-transition-property: width, height;
-ms-transition-property: width, height;
}
div:hover {
width: 300px;
height: 200px;
background: #ff0;
}
記事の間違いや著作権の侵害等ございましたらお手数ですがこちらまでご連絡頂ければ幸いです。