Chapter 2 Global attributes and other-original learning points of water:
1. Entity
2. Metadata
3. Global attributes
Lecturer: Li Yanhui
This chapter mainly discusses HTML entities in HTML5 and the metadata of HTML core components. Finally, we will take a look at the global attributes in HTML.
I. Entity
HTML entities display special characters in Entity code.
Ii. Metadata
Elements can define various metadata in the document, and an HTML page can contain multiple Element.
1.Name/Value metadata pair
Metadata name |
Description |
Author |
Author of the current page |
Description |
Description of the current page |
Keywords |
Keyword of the current page |
Generator |
Encoding tool for the current page |
2. Declare character encoding
3. Simulate the HTTP header field
// Jump to the specified URL in 5 seconds
// Another type of declarative character encoding
Attribute Value |
Description |
Refresh |
Reload the current page or specify a URL. Unit: seconds. |
Content-type |
Another way to declare character encoding |
Iii. Global attributes
Before that, we have explained all the elements involved in its local data. Of course, we also know some global attributes, such as id. Global attributes are common actions of all elements. HTML5 also provides some other global attributes.
1. idAttribute
Section
Explanation: The id attribute assigns a unique identifier to the element. This identifier is usually used to select elements for CSS and JavaScript calls. Only one id can appear at a time on a page.
2. classAttribute
Section
Section
Section
Explanation: The class attribute is used to classify elements. You can set CSS styles at the same time by setting one or more elements in the document.
3. accesskeyAttribute
Explanation: shortcut key operation. In windows, alt + specifies the key, provided that the alt of the browser does not conflict.
4. contenteditableAttribute
Can I modify it?
Explanation: make the text editable. If it is set to true, the text can be edited. If it is set to false, the text cannot be edited. Or directly set properties.
5. dirAttribute
Text to the right
Explanation: Let the text be left-to-right (ltr) or right-to-left (rtl ).
6. hiddenAttribute
Text to the right
Explanation: Hide elements.
7. langAttribute
HTML5
Explanation: You can set the language locally.
8. titleAttribute
HTML5
Explanation: Add a prompt to the content of the element.
9. tabindexAttribute
Explanation: press the tab key in the form to obtain the focus sequence. If it is-1, it will not be selected.
10. styleAttribute
CSS style
Description: sets the CSS style in the element row.