I'm using details to make content sections collapsible. I've set the summary h3 to be display: inline-block; so the marker is in line with the header.
Unfortunately, when the title wraps to multiple lines, the marker jumps to above the header.
How can I ensure that even multi-line summaries have a sensible marker placement?
summary h3 {
display: inline-block;
}
<details>
<summary>
<h3>Short line</h3>
</summary>
</details>
<details>
<summary>
<h3>Wow very long line, I hope this wraps sensibly and keeps the arrow in a good place.</h3>
</summary>
</details>
<details>
<summary>
<h3>Wow very long line, I hope this wraps sensibly and keeps the arrow in a good place. Wow very long line, I hope this wraps sensibly and keeps the arrow in a good place. Wow very long line, I hope this wraps sensibly and keeps the arrow in a good place.</h3>
</summary>
</details>
A bit of styling will fix it. Turn off the standard list markers, add your own with a pseudo element, then make the whole thing a flexbox.
Note that while you are technically allowed to put an
<h3>inside a<summary>, I prefer to keep it simple.