Note/Info The <dialog> tag is a new tag in HTML5.
HTML5 <dialog> tag
The <dialog> creates dialog box. It helps in creating components like popup, inspector or modal window in the same browser window.
This is mainly used as a part of application with whom the user can interact.
If you do not code the open attribute with this tag , then you must use JavaScript to open or close the dialog box. The HTMLDialogElement contains a number of methods for this purpose –
- show() – To show the dialog box.
- showModal() – Displays the modal dialog.
- close() – Closes the dialog box.
Syntax:
<dialog open>Some text</dialog>
Default value
NONE
Difference between HTML4.01, XHTML and HTML5
HTML4 | XHTML | HTML5 |
---|---|---|
NA | NA | New tag in HTML5 |
Attributes used with <dialog> tag
Attribute | Description |
---|---|
open | to inform the browser that the dialog window in active. |
Global Attributes
The <dialog> tag does supports Global attributes.
Event Attributes
The <dialog> tag supports Event attributes.
Supporting Browsers
Mozilla Firefox and Safari have limited support for this tag and started supporting this tag.
The Internet Explorer/Edge does not support this tag.
Related Tags
None.