You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/basics/pseudos.mdx
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -168,8 +168,37 @@ There are two exceptions:
168
168
169
169
- The API ignores the `view-transition-name` of a fragmented element, i.e. an element that consists of two or more boxes, like an inline element that spans two lines. View transition names assigned to such elements are ignored.
170
170
171
-
- The API also ignores the `view-transition-name` of an element if that element is not rendered, like the `<head>`, or if it is skipped. For instance, you can use the same `view-transition-name` multiple times within the same DOM, provided that all but one instance have their `display` CSS property set to `none`. This can also be done by setting an HTML element's hidden attribute or property. Looking for an example? This technique is utilized in the intra-document [image morph examples](/basics/examples/#image-morph-examples) on this site. This trick also works with an ancestor with `content-visibility: hidden` but not with a simple `visibility: hidden` directly on the element.
171
+
- The API also ignores the `view-transition-name` of an element if that element is not renderedor skipped.
172
172
173
+
### Hiding View Transition Names
174
+
There are several ways to prevent the rendering of an element and thus to hide its view transition name.
175
+
176
+
You can hide elements by adding the `hidden` attribute.
177
+
|HTML attribute|effect|
178
+
|-|-|
179
+
|`hidden`|hides view transition names of subtree|
180
+
181
+
Or you can use CSS properties to hide view transition names:
Here `view-transition-scope` is a new CSS property that is currently only supported in Chrome. With value `all` it hides the view transition names of its subtree but does not change the rendering of the elements.
192
+
193
+
With these mechanisms to hide view transition names, you can use the same `view-transition-name` multiple times within the same DOM, provided that all but one instance are hidden.
194
+
195
+
Looking for an example? This technique is utilized in the intra-document [image morph examples](/demo/BasicS/) on this site, where one element has `display: none` and the other has `display: block`.
196
+
197
+
This trick also works with `content-visibility: hidden` but not with a simple `visibility: hidden` directly on the element.
198
+
199
+
200
+
201
+
### Special Names
173
202
The static user agent stylesheet provides one default name for the document, called `root`.
0 commit comments