Details Arrow Rotate
CSS
Medium
3 views
Problem Description
Rotate a small arrow when a details element is open.
Output Format
Print the HTML+CSS code in one block.
Constraints
Use details[open] selector and transition on the arrow.
Official Solution
<!doctype html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>meetcode</title>
<style>
summary { cursor: pointer; display: flex; align-items: center; gap: 8px; }
.arrow { display: inline-block; transition: transform 180ms ease; }
details[open] .arrow { transform: rotate(90deg); }
</style>
</head>
<body>
<details>
<summary><span class='arrow'>›</span> What is meetcode?</summary>
<p>A place to practice small coding questions.</p>
</details>
</body>
</html>
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!