Reputation: 402
When creating a modal in HTML (dialog window displayed on top of the current page), what is the most appropriate when putting HTML heading on the top of div?:
H1? H2? What is the most correct?
Upvotes: 0
Views: 451
Reputation: 80138
The MDN docs suggest against using multiple h1
elements on the page in this manner:
Note: Nesting multiple elements in nested sectioning elements was allowed in older versions of the HTML standard. However, this was never considered a best practice and is now non-conforming. Read more in There Is No Document Outline Algorithm.
I do not suspect there is a standard for this otherwise, and would advise using the level of element that makes the most sense based on the rest of your page. And if you are concerned about semantics, you may want to consider using a <dialog>
element (docs) rather than a <div>
.
Upvotes: 2