<dialog>...</dialog>

HTML4 HTML5

Represents a dialog box, modal, or popup window. Can be easily managed via native JavaScript methods (like showModal(), show(), or close()) without external libraries.

Both opening and closing tags are required.

Attributes:

open - Displays the dialog window on page load without needing a script call.

Example

Code:

<dialog open style="border: 1px solid #ccc; border-radius: 8px; padding: 15px; box-shadow: 0 4px 6px rgba(0,0,0,0.1);"> <h3 style="margin-top: 0;">System Notification</h3> <p>Are you sure you want to save the changes?</p> <div style="text-align: right;"> <button type="button" style="padding: 5px 10px; margin-right: 5px;">Cancel</button> <button type="button" style="padding: 5px 10px; background-color: #007bff; color: white; border: none; border-radius: 3px;">Confirm</button> </div> </dialog>

The browser will interpret this code as follows:

System Notification

Are you sure you want to save the changes?