The <dialog>
element is used to define a dialog box, interactive component, or subwindow in a webpage. It allows the user to create popup dialogs and windows. The text to be shown in a dialog box is enclosed within <dialog>
and </dialog>
tags.
The <dialog>
tag supports global attributes, attributes common to all HTML elements (e.g. class, id, lang, title, etc.) It also supports
An important additional attribute is open
. This tag indicates whether the dialog will be shown to the user of the webpage. When this attribute is not set, the dialog will not be shown to the user.
The following code snippet shows how the <dialog>
tag is used to create a dialog box.