diff options
Diffstat (limited to 'files/zh-tw/web/css/transition/index.html')
-rw-r--r-- | files/zh-tw/web/css/transition/index.html | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/files/zh-tw/web/css/transition/index.html b/files/zh-tw/web/css/transition/index.html new file mode 100644 index 0000000000..3e5b3c042c --- /dev/null +++ b/files/zh-tw/web/css/transition/index.html @@ -0,0 +1,106 @@ +--- +title: transition +slug: Web/CSS/transition +tags: + - CSS + - CSS Property + - CSS轉場 + - Reference +translation_of: Web/CSS/transition +--- +<div>{{CSSRef}}</div> + +<p><strong><code>transition</code></strong> <a href="/zh-TW/docs/Web/CSS" title="CSS">CSS </a>屬性是 {{ cssxref("transition-property") }}, {{ cssxref("transition-duration") }}, {{ cssxref("transition-timing-function") }}, and {{ cssxref("transition-delay") }}的 <a href="/zh-TW/docs/Web/CSS/Shorthand_properties" title="/en-US/docs/CSS/Shorthand_properties">特性簡寫</a>。</p> + +<div>{{EmbedInteractiveExample("pages/css/transition.html")}}</div> + + + +<p>Transitions 讓你可以定義元件在兩個狀態之間切換的轉場效果。兩個不同狀態可以使用<a href="/zh-TW/docs/Web/CSS/Pseudo-classes" title="/en-US/docs/CSS/Pseudo-classes">虛擬類別</a> 定義,像是{{cssxref(":hover")}} 或 {{cssxref(":active")}} 亦或是 使用JavaScript設定的狀態變化。</p> + +<h2 id="語法"><strong>語法</strong></h2> + +<pre class="brush:css no-line-numbers">/* Apply to 1 property */ +/* property name | duration */ +transition: margin-right 4s; + +/* property name | duration | delay */ +transition: margin-right 4s 1s; + +/* property name | duration | timing function */ +transition: margin-right 4s ease-in-out; + +/* property name | duration | timing function | delay */ +transition: margin-right 4s ease-in-out 1s; + +/* Apply to 2 properties */ +transition: margin-right 4s, color 1s; + +/* Apply to all changed properties */ +transition: all 0.5s ease-out; + +/* Global values */ +transition: inherit; +transition: initial; +transition: unset; +</pre> + +<p><code>transition</code> 屬性可以包含一個或多個轉場設定,每一項設定都以逗點分開。</p> + +<p>每一項設定都描述著每一項屬性所對應的轉場效果(或是<code>all</code> 及 <code>none</code>這兩個特殊值) 。其包含了:</p> + +<ul> + <li>無或一個對應的屬性名稱。可以是: + <ul> + <li>關鍵字 <code>none</code></li> + <li>關鍵字 <code>all</code></li> + <li>以{{cssxref("<custom-ident>")}}命名的CSS屬性。</li> + </ul> + </li> + <li>無或一個{{cssxref("<single-transition-timing-function>")}} 表示所使用的漸變函式。</li> + <li>無、一個或兩個{{cssxref("<time>")}} 值。第一個值會被指派給{{cssxref("transition-duration")}}, 而第二個則被指派給{{cssxref("transition-delay")}}。</li> +</ul> + +<p>當每個轉場設定不等長時,請參見 <a href="/zh-TW/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions#當_property_value_list_之間並不等長時_..." title="en/CSS/CSS transitions#When property value lists are of different lengths">當property values list 之間不等長時...</a> 。簡而言之,多餘的描述(超過實際被執行的數量)會直接被忽略。</p> + +<h3 id="標準語法">標準語法</h3> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="範例">範例</h2> + +<p><a href="/zh-TW/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions" title="en/CSS/CSS transitions">CSS 轉場</a> 有更多範例。</p> + +<h2 id="規範">規範</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{ SpecName('CSS3 Transitions', '#transition-shorthand-property', 'transition') }}</td> + <td>{{ Spec2('CSS3 Transitions') }}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<p>{{cssinfo}}</p> + +<h2 id="瀏覽器支援情況">瀏覽器支援情況</h2> + + + +<p>{{Compat("css.properties.transition")}}</p> + +<h2 id="更多資訊">更多資訊</h2> + +<ul> + <li><a href="/zh-TW/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions" title="en/CSS/CSS transitions">CSS轉場</a></li> + <li>{{ domxref("TransitionEvent") }}</li> +</ul> |