Can a <summary> HTML element be a Heading element? (H2, H3, H4)
I randomly came across a thought while writing HTML for a client's site: can a HTML summary (
<summary>) be a heading element, such as H2, H3 or H4?
So basically this:
<details><summary><h3>About Keyboards</h3></summary><p>A computer keyboard is a peripheral input device modeled after the typewriter keyboard...</p></details>
I looked into it, and yes it can be a heading! One heading is allowed per summary, so just make sure the H2, H3 or H4 that you are using is the only element inside your summary element. The content should come after it, like on the example above.
Here's my source for it: