-
Notifications
You must be signed in to change notification settings - Fork 23.2k
Add view-transition-class property #37901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
3855456
437c128
083b0ec
04c9080
b23ef8e
57dd7d2
9330ffa
5181b1f
fbdca61
befd716
51fe46f
220f478
a8b1559
51a5576
d185c71
a8c7481
f850a86
d397111
74470b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| title: view-transition-class | ||
| slug: Web/CSS/view-transition-class | ||
| page-type: css-property | ||
| status: | ||
| - experimental | ||
| browser-compat: css.properties.view-transition-class | ||
| --- | ||
|
|
||
| {{CSSRef}} | ||
|
|
||
| The **`view-transition-class`** [CSS](/en-US/docs/Web/CSS) property provides the selected elements with an identifying class (a {{cssxref("custom-ident")}}), providing an additional method of styling the view transitions for those elements. | ||
|
|
||
| > [!NOTE] | ||
| > Each individual element still needs its own unique {{cssxref("view-transition-name")}}. In browsers that don't support `view-transition-class`, you would also need to have a custom `::view-transition-group` for each element. Support for determining the `view-transition-name` automatically is being discussed in the [CSS View Transitions Module Level 2](https://drafts.csswg.org/css-view-transitions-2/#auto-vt-name) spec. | ||
|
bsmth marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Syntax | ||
|
|
||
| ```css | ||
| /* <custom-ident> value examples */ | ||
| view-transition-class: card; | ||
|
|
||
| /* Keyword value */ | ||
| view-transition-class: none; | ||
|
cssinate marked this conversation as resolved.
|
||
|
|
||
| /* Global values */ | ||
| view-transition-class: inherit; | ||
| view-transition-class: initial; | ||
| view-transition-class: revert; | ||
| view-transition-class: revert-layer; | ||
| view-transition-class: unset; | ||
| ``` | ||
|
|
||
| ### Values | ||
|
|
||
| - {{cssxref("custom-ident")}} | ||
| - : An identifying name that causes the selected element to participate in a separate [view transition](/en-US/docs/Web/API/View_Transition_API) from the root view transition. The identifier must be unique. If two rendered elements have the same `view-transition-name` at the same time, {{domxref("ViewTransition.ready")}} will reject and the transition will be skipped. | ||
| - `none` | ||
| - : No class would apply to the named view transition pseudo-elements generated for this element. | ||
|
|
||
| ## Formal definition | ||
|
bsmth marked this conversation as resolved.
|
||
|
|
||
| {{cssinfo}} | ||
|
|
||
| ## Formal syntax | ||
|
|
||
| {{csssyntax}} | ||
|
|
||
| ## Examples | ||
|
|
||
| ```css | ||
| ::view-transition-group(.card) { | ||
| animation-duration: 3s; | ||
| } | ||
|
|
||
| .card { | ||
| view-transition-class: card; | ||
| } | ||
|
|
||
| .card#card1 { | ||
| view-transition-name: card1; | ||
| } | ||
|
|
||
| .card#card2 { | ||
| view-transition-name: card2; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This example likely works, but the reader will not know if the .card in the vtg parameter is the class of the element or the value of the vtc with a period in front of it. I suggest using two different class namet to make this clear.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried to improve in f850a86 if you can have a look |
||
| } | ||
| ``` | ||
|
|
||
| ## Specifications | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - {{cssxref("view-transition-name")}} | ||
|
bsmth marked this conversation as resolved.
|
||
| - [View Transition API](/en-US/docs/Web/API/View_Transition_API) | ||
| - [Smooth transitions with the View Transition API](https://developer.chrome.com/docs/web-platform/view-transitions/) | ||
Uh oh!
There was an error while loading. Please reload this page.