Attributes: 1. contenteditable attribute; 2. contextmenu attribute; 3. "data-*" attribute; 4. draggable attribute; 5. dropzone attribute; 6. hidden attribute; 7. spellcheck attribute; 8. translate Attributes.
The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
What new global attributes are added to HTML5?
In HTML, global attributes are attributes that can be used with all HTML elements.
In html5, there are eight new global attributes. Let’s take a look at each one below.
1. contenteditable attribute
The contenteditable attribute specifies whether the element content is editable.
Note: When the contenteditable attribute is not set in an element, the element will inherit from the parent element.
The syntax is:
<element contenteditable="true|false">
The example is as follows:
<html>
<head>
<meta charset="utf-8">
<title>123</title>
</head>
<body>
<p contenteditable="true">这是一个段落。是可编辑的。尝试修改文本。</p>
</body>
</html>
Output result:
##2, contextmenu Attribute
Currently only the Firefox browser supports the contextmenu attribute.
The contextmenu attribute specifies the context menu of the element. A context menu will appear when the user right-clicks an element. The value of the /p>
contextmenu attribute is the id of the
The above is the detailed content of What new global attributes are added to HTML5?. For more information, please follow other related articles on the PHP Chinese website!