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

What are the attributes of html elements?

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

Share

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

What are the attributes of html elements? I believe many inexperienced people are at a loss about this. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Html element attributes are: accesskey, class, contenteditable, contextmenu, "data-*", dir, draggable, dropzone, hidden, id, lang, spellcheck, style, and so on.

The operating environment of this tutorial: windows7 system, HTML5 version, Dell G3 computer.

What are attributes?

Attributes can provide some additional information for the HTML tag, or decorate the HTML tag. The attribute needs to be added to the opening tag, and the syntax format is:

Attr= "value"

Attr represents the property name, and value represents the attribute value. Property values must be surrounded by double quotes "" or single quotation marks''.

Note that although both double quotes and single quotes can surround attribute values, use double quotes as much as possible for the sake of standardization and professionalism.

A tag can have no attributes, or it can have one or more attributes.

There are many HTML attributes, which can be broadly divided into two categories:

Some attributes apply to most or all of the HTML tags, and we call them generic attributes

Some attributes apply only to one or more specific HTML tags, and we call these attributes proprietary attributes.

Common attributes (global attributes)

Property describes how accesskey sets keyboard shortcuts to access elements. Class specifies the class name of the element (classname) contenteditable specifies whether the content of the element can be edited. Contextmenu specifies the context menu for an element. When the user right-clicks the element, the context menu data-* appears to store the custom data of the page, the dir sets the text orientation of the content in the element. Draggable specifies whether an element can be dragged dropzone specifies whether the data will be copied, moved, or linked, or deleted the hiddenhidden attribute specifies that the element is hidden. Id specifies the language code of the content in the element's unique idlang setting element. Spellcheck detects whether the element is misspelled style specifies the inline style of the element (inline style) tabindex sets the Tab key to control the order of the element. Title specifies additional information about the element (which can be displayed in the tooltip) translate specifies whether the value of an element needs to be translated when the page loads

Special attribute

Here are some attributes of common tags.

Attributes of the tag

Property value description charsetchar_encodingHTML5 is not supported. Specifies the character encoding of the target URL. CoordscoordinatesHTML5 does not support it. Specifies the coordinates of the link. Downloadfilename specifies the download link hrefURL specifies the target URL of the link. Hreflanglanguage_code specifies the benchmark language of the target URL. Used only if the href property exists. Mediamedia_query specifies the media type of the target URL. Default value: all. Used only if the href property exists. Namesection_nameHTML5 does not support it. Specify the name of the anchor. Relalternate

Author

Bookmark

Help

License

Next

Nofollow

Noreferrer

Prefetch

Prev

Search

Tag specifies the relationship between the current document and the target URL. Used only if the href property exists. RevtextHTML5 does not support it. Specifies the relationship between the target URL and the current document. Shapedefault

Rect

Circle

PolyHTML5 does not support it. Specifies the shape of the link. Target_blank

_ parent

_ self

_ top

Framename

Specifies where to open the target URL. Used only if the href property exists.

_ blank: a new window opens.

_ parent: open the link in the parent window.

_ self: by default, the current page jumps.

_ top: opens a link in the current form and replaces the current entire form (frame page).

TypeMIME_type specifies the MIME type of the target URL. Used only if the href property exists.

Note: MIME = Multipurpose Internet Mail Extensions.

Attributes of the tag

Property value description acceptMIME_typeHTML5 is not supported. Specifies the type of file received by the server. (files are submitted through file upload) accept-charsetcharacter_set specifies the character set of form data that can be processed by the server. ActionURL specifies where to send form data when the form is submitted. Autocompleteon

Off specifies whether the autocomplete feature of the form is enabled. Enctypeapplication/x-www-form-urlencoded

Multipart/form-data

Text/plain specifies how the form data is encoded before it is sent to the server. (for method= "post" cases) methodget

Post specifies the HTTP method used to send form data. Nametext specifies the name of the form. If novalidatenovalidate uses this attribute, no validation is performed when the form is submitted. Target_blank

_ self

_ parent

_ top specifies where to open the action URL.

Attributes of the tag

The attribute value description manifestURL defines a URL on which the document's cache information is described. Xmlns http://www.w3.org/1999/xhtmlHTML does not support it. Only XHTML supports it. Specify the namespace attribute of the XML (use this attribute if you need your content to conform to XHTML. ).

Attributes of the tag

The property value description disableddisabled specifies that this option should be disabled when it is first loaded. Labeltext defines the dimensions to be used when used. The selectedselected specifies that the option is selected (when it is first displayed in the list). Valuetext defines the option values that are sent to the server. After reading the above, have you mastered the methods of html element attributes? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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