What is HTML5 dialog? How to use dialog in HTML5 to simulate pop-up windows? This article mainly describes the definition and specific usage of the dialog tag in HTML5, and how to simulate pop-up windows through the dialog tag in HTML5.
Definition and usage of HTML5 dialog tag:
Here are examples:
<dialog>
<dt>老师</dt>
<dd>1+1 等于?</dd>
<dt>学生</dt>
<dd>2</dd>
<dt>老师</dt>
<dd>答对了!</dd>
</dialog>
Copy after login
Tips and Notes:
Tip: Every sentence in the dialogue must belong to the
tag defined part. Please see the example below. Tag definition and usage instructions:
This is an example:
<table border="1">
<tr>
<th>January <dialog open>This is an open dialog window</dialog></th>
<th>February</th>
<th>March</th>
</tr>
<tr>
<td>31</td>
<td>28</td>
<td>31</td>
</tr>
</table>
Copy after login
HTML5 dialog tag attribute:
open: open specifies that the dialog element is valid and the user can interact with it .
Recently, many processes on the web require the user's full consent before they can be completed. For example, users may need to delete an account, change their username, or confirm a monetary transaction.
In this case, the common user experience (UX, User experience design) is to display a dialog box with two buttons. One is to cancel and the other is to continue. For many years, we have relied on JavaScript libraries to achieve this effect, but in this article, we are going to use the
Use the dialog element: