Home  >  Article  >  Web Front-end  >  Summary and sharing of common global attributes

Summary and sharing of common global attributes

巴扎黑
巴扎黑Original
2017-06-16 17:09:421447browse

HTML attributes give meaning and context to elements.

The following global attributes can be used on any HTML element.

HTML attributes give meaning and context to elements. The so-called global attributes refer to attributes that can be used by any element.

The following are commonly used global attributes:

1. Accesskey attribute

The accesskey attribute specifies the shortcut key for activating elements. accesskey="accesskey", use ALT+accesskey (shinft+alt+accesskey) to access elements with specified shortcut keys.

[html] view plain copy

Baidu

Sogou

Press and hold the shortcut key alt+h. Open the Baidu web page. Similarly, press and hold the shortcut key alt+c to open the Sogou web page.

2. The id and class attributes are to name the element a unique id and class name respectively.

3. Tabindex attribute

The tabindex attribute specifies the tab key control sequence (when the tab key is used for navigation), and the order in which elements are focused when the tab key is pressed. tabindex="number", "number" represents the order of focus

[html] view plain copy

Baidu

Sogou< ;br>

Sina

When the tab key is pressed once, the focus is on "Sogou",

When the tab key is pressed the second time, the focus is on "Baidu"

Similarly, when the tab key is pressed for the third time, the focus will be on "Sina",

4. hidden attribute

The hidden attribute specifies that the element is hidden, indicating that the element Not relevant, Boolean value.

5. The contenteditable attribute

The contenteditable attribute specifies whether the element content is editable. "true" means it can be edited, and "false" means it cannot be edited.

[html] view plain copy

This text can be edited

This text cannot be edited

When the mouse clicks on the first text, there will be a prompt that the text can be edited, as shown in the picture:

When the mouse clicks on the second paragraph of text, no editable prompt is displayed, as shown in the figure:

6. Other global attributes, such as: style, title, lang, spellcheck, translage, dir, draggable, dropzone wait

The above is the detailed content of Summary and sharing of common global attributes. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn