Home » ★CSS3リファレンス

★CSS3リファレンス

transition-property …… transition効果を適用するCSSプロパティ名を指定する
Firefox4(-moz-)
Google Chrome1(-webkit-)Google Chrome2(-webkit-)Google Chrome3(-webkit-)Google Chrome4(-webkit-)Google Chrome5(-webkit-)
Safari3(-webkit-)Safari4(-webkit-)Safari5(-webkit-)
広告



transition-propertyプロパティは、transition(時間的変化)効果を適用するCSSプロパティ名を指定する際に使用します。

複数のCSSプロパティに変化を適用する場合には、変化させるプロパティのリストをカンマ区切りで指定します。

値にnoneを指定すると、どのプロパティも変化しません。
また、allを指定すると、変化を適用できるプロパティすべてが変化します。

■値

all
変化を適用できるプロパティすべてが変化する(初期値)
none
どのプロパティも変化しない
プロパティ名
変化させるプロパティ名のリストをカンマ( , )区切りで指定

■初期値・適用対象・値の継承

初期値
all
適用対象
すべての要素、:before擬似要素、:after擬似要素
値の継承
しない

■使用例

CSSソースは外部ファイル(sample.css)に記述

div.sample {
background-color:blue; width:200px; height:50px;
transition-property: background-color, width, height;
transition-duration:1s;
transition-timing-function:ease-in-out;
}

div.sample:hover {
background-color:aqua; width:300px; height:100px;
}

HTMLソース

<html>
<head>
<link rel=”stylesheet” href=”sample.css”
type=”text/css”>
</head>
<body>
<div class=”sample”>transitionの使用例</div>
</body>
</html>

↓↓↓

ブラウザ上の表示

transitionの使用例

■ベンダープレフィックスを付けた場合の使用例

CSSソースは外部ファイル(sample.css)に記述

div.prefix_sample {
background-color:blue; width:200px; height:50px;

-moz-transition-property: background-color, width, height;
-webkit-transition-property: background-color, width, height;
-o-transition-property: background-color, width, height;
-ms-transition-property: background-color, width, height;

-moz-transition-duration:1s;
-webkit-transition-duration:1s;
-o-transition-duration:1s;
-ms-transition-duration:1s;

-moz-transition-timing-function:ease-in-out;
-webkit-transition-timing-function:ease-in-out;
-o-transition-timing-function:ease-in-out;
-ms-transition-timing-function:ease-in-out;
}

div.prefix_sample:hover {
background-color:aqua; width:300px; height:100px;
}

HTMLソース

<html>
<head>
<link rel=”stylesheet” href=”sample.css” type=”text/css”>
</head>
<body>
<div class=”prefix_sample”>transitionの使用例</div>
</body>
</html>

↓↓↓

ブラウザ上の表示

transitionの使用例

広告



Lorem Ipsum is simply dummy text

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.