Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of html5 Global Properties

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces the example analysis of the global properties of html5, which has a certain reference value, and interested friends can refer to it. I hope you will gain a lot after reading this article.

1.accesskey

The accesskey property allows you to set one or more keyboard shortcuts so that you can select elements on the page. Let's look at the following example:

The code is as follows:

Example

Name:

Password:

In this example, you can use key combinations to select elements on the page. For example, in windows operating system, you can use alt+XXX to select an element.

2.class

I don't want to say much about this attribute, which is a function of grouping elements, which is more often used in combination with css to set different display effects for different groups of elements.

3.contenteditable

This is a new attribute for html5. Add the contenteditable attribute to the html element and set it to true to allow the user to edit the element content; set to false to disallow the user to edit the element content.

The code is as follows:

Example

It is raining right now

4.contextmenu

Contextmenu allows the user to set the right-click menu of the html element, which pops up when the user triggers it. So far, no browser supports this property.

5.dir

The dir attribute defines the alignment of html element text, supporting two values, ltr (from left to right) and rtl (from right to left).

The code is as follows:

Example

This is right-to-left

This is left-to-right

6.draggable

Draggable is an attribute in html5 that implements the drag-and-drop function of html elements, which we will cover in more detail later in the course.

7.dropzone

Dropzone is also an attribute in html5 that implements the drag and drop function of html elements, which we will cover in more detail later in the course.

8.hidden

This attribute should be familiar to everyone, which is to hide a html element.

9.id

As you all know, this attribute sets a unique identity for the html element, and the equivalent id element is not allowed in a html page.

10.lang

Lang specifies the language in which the html element content is used. The value of lang must be a valid iso language code. You can visit the address below for more details, http://tools.ietf.org/html/bcp47. It should be noted that dealing with language is a very complex and technical thing.

The code is as follows:

Example

Hello-how are you?

Bonjour-comment ê tes-vous?

Hola -? C ó mo est á s?

11.spellcheck

When using the spellcheck attribute, the browser will check that the text content of the html element is spelled correctly, and the spellcheck attribute is meaningful only if the html element is editable.

The code is as follows:

Example

This is some mispelled text

12.style

Without going into much detail, this attribute sets the css style for the html element.

13.tabindex

Tabindex allows you to define the access order of html elements when they use the tab key. When tabindex is set to-1, the html element will not be selected when the user uses the tab key.

The code is as follows:

Example

Name:

City:

Country:

14.title

Title can provide additional information for the html element, which is often used to display prompts.

The code is as follows:

Example

Visit the Apress site

Thank you for reading this article carefully. I hope the article "sample Analysis of html5 Global attributes" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report