Animating the <details> Marker Triangle
Moritz Gießmann has published a small CodePen demo that animates the triangle on a <details> element. That triangle is the affordance signaling that the element can be opened; animating it adds a second signal, telling the user the element is opening right now.
The technique rests on three steps:
- The default marker has to go, since it cannot be animated:
details summary::-webkit-details-marker { display:none; }. - A replacement triangle is drawn with the CSS border trick inside a pseudo element.
- When the element is open, the new triangle is rotated with
details[open] > summary::before { transform: rotate(90deg); }.
This covers the triangle only — the content inside the element still snaps open. For a smoother reveal, the same article points to Louis Hoebregts' "How to Animate the Details Element Using WAAPI". A fork combining both approaches is also mentioned.
One detail worth noting: Moritz places cursor: pointer; on the summary, matching Greg Gibson's suggestion.




