Last active
September 12, 2025 12:33
-
-
Save yanli0303/ab56801f4b88a077c485587c0ff21a80 to your computer and use it in GitHub Desktop.
Open & Close Transitions with <details>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style type="text/css"> | |
| details { | |
| inline-size: 50ch; | |
| @media (prefers-reduced-motion: no-preference) { | |
| interpolate-size: allow-keywords; | |
| } | |
| &::details-content { | |
| opacity: 0; | |
| block-size: 0; | |
| overflow-y: clip; | |
| transition: content-visibility 1s allow-discrete, | |
| opacity 1s, | |
| block-size 1s; | |
| } | |
| &[open]::details-content { | |
| opacity: 1; | |
| block-size: auto; | |
| } | |
| } | |
| @layer support { | |
| * { | |
| box-sizing: border-box; | |
| margin: 0; | |
| } | |
| html { | |
| block-size: 100%; | |
| color-scheme: dark light; | |
| } | |
| body { | |
| min-block-size: 100%; | |
| font-family: system-ui, sans-serif; | |
| display: grid; | |
| place-content: center; | |
| } | |
| summary { | |
| cursor: pointer; | |
| } | |
| } | |
| </style> | |
| <h1>Open & Close Transitions with <details></h1> | |
| <a href="https://nerdy.dev/open-and-close-transitions-for-the-details-element?utm_source=feedly" target="_blank" rel="noopener noreferrer"> | |
| From: Adam Argyle | |
| </a> | |
| <hr/> | |
| <details> | |
| <summary>Details interpolation example</summary> | |
| <p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Aliquid dolores, distinctio ipsum veritatis magni soluta maiores rerum optio, possimus animi eligendi architecto sed placeat quasi quibusdam, nihil odio. Amet, tempore.</p> | |
| </details> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See it here on GitHack