Newly Added and abolished attributes of HTML5

Source: Internet
Author: User

In HTML5, many attributes are added and abolished while many elements are added and abolished.

New attribute

1. Form-related attributes

  • Specify the autofocus attribute for input (type = text), select, textarea, And button. It enables the element to automatically obtain the focus when the screen is opened.
  • Specify the placeholder attribute for input (type = text) and textarea. It will prompt the user's input, prompting the user to enter the content.
  • Specify the form attribute for input, output, select, textarea, button, and fieldset. It declares the form to which it belongs, and places it in any position on the page without losing it.
  • Specify the required attribute for input (type = text) and textarea. This attribute indicates that the user performs a check when submitting the request. Check that the input content must exist in the element.
  • Add several new attributes for the input Tag: autocomplete, min, max, multiple, pattern, and step. You can also use the list attribute with the datalist element, and use the datalist element with the autocomplete attribute. The multiple Attribute allows multiple files to be uploaded at a time. The pattern attribute is used to verify the mode of the input field, which is actually a regular expression. The step attribute specifies the valid numeric interval of the input field (if step = "3", the valid numeric value should be-3, 0, 3, 6, and so on ), the step attribute can be used with the max and min attributes to create a valid value range.
  • Add the formaction, formenctype, forpolichod, formnovalidate, and formtarget attributes to the input and button elements. You can reload the action, enctype, method, novalidate, and target attributes of the form element. Add the disabled attribute to the fieldset element. You can set its child element to the disabled state.
  • Add the novalidate attribute to input, button, and form. You can cancel the related checks during submission, and the form can be submitted unconditionally.

2. Link-related attributes

  • Adds media attributes for a and area. Specify the reason why the target URL is optimized for media/devices. This attribute is used to specify that the target URL is designed for special devices (such as the iPhone), voice, or print media. This property can accept multiple values. It can only be used when the href attribute exists.
  • Add the herflang and rel attributes for the area.HreflangAttribute specifies the language of the text in the linked document. This attribute can be used only when the href attribute is set. Note: This property is purely consulting.RelAttribute specifies the relationship between the current document and the linked document/resource. The rel attribute can be used only when the href attribute is used.
  • Adds the size attribute to the link. The sizes attribute specifies the size of the linked resource. This attribute can be used only when the linked resource is an icon (rel = "icon. This property can accept multiple values. Values are separated by spaces.
  • Add the target attribute to the base element to maintain consistency with the element.

3. Other attributes

  • Adds the reversed attribute to ol, which specifies the reverse display of the list.
  • Add charset attribute for meta
  • Add the type and label attributes to the menu. Label defines the annotation of A Courseware for the menu. The type attribute enables the following menu, toolbar, and list cande to appear.
  • Adds the scoped attribute to the style. It allows us to define styles for specified parts of the document, rather than the entire document. If the "scoped" attribute is used, the specified style can only be applied to the parent element and its child element of the style element.
  • Adds or deletes a script Attribute. It defines whether the script is executed asynchronously. The async attribute is only applicable to external scripts (only when the src attribute is used). There are multiple ways to execute external scripts:
    • If async = "async": the script is executed asynchronously relative to the rest of the page (when the page continues to be parsed, the script will be executed)
    • If async is not used and defer = "defer": the script will be executed when parsing is completed on the page.
    • If neither async nor defer is used: read and execute the script immediately before the browser continues parsing the page
  • Add manifest to the html element. When an offline web application is developed, manifest is used with the API to define a URL that describes the cached information of the document.
  • Add attributes sandbox, seamless, and srcdoc to iframe. It is used to improve page security and prevent untrusted web pages from performing some operations.

Abolished attributes

Some attributes in HTML4 are no longer used in html5. they are replaced by other attributes or other methods.

Attributes used in HTML 4

Elements Using this attribute

Alternative solution in HTML 5

Rev

Link,

Rel

Charset

Link,

Use the HTTP Content-type Header element in the linked Resource

Shape, Coords

A

Use the area element to replace element

Longdesc

Img, iframe

Use element a to link to Principal description

Target

Link

Redundant attribute, omitted

Nohref

Area

Redundant attribute, omitted

Profile

Head

Redundant attribute, omitted

Version

Html

Redundant attribute, omitted

Name

Img

Id

Scheme

Meta

Use scheme only for a form field

Archive, Chlassid, codebose, codetype, declare, standby

Object

Use the data and typc attribute classes to call the plug-in. When you need to use these attributes to set parameters, use the param attribute.

Valuetype, Type

Param

The MIME type that is not declared using the name and value Attributes

Axis, Abbr

Td, th

Use a format that starts with a clear and concise text, followed by detailed text. You can use the title attribute for more details to make the content of a cell brief.

Scope

Td

Use the HTTP Content-type Header element in the linked Resource

Align

Caption, input, legend, div, h1, h2, h3, h4, h5, h6, p

Use CSS style sheets instead

Alink, Link, text, vlink, background, bgcolor

Body

Use CSS style sheets instead

Align, Bgcolor, border, cellpadding, cellspacing, frame, rules, width

Table

Use CSS style sheets instead

Align, Char, charoff, height, nowrap, valign

Tbody, thead, tfoot

Use CSS style sheets instead

Align, Bgcolor, char, charoff, height, nowrap, valign, width

Td, th

Use CSS style sheets instead

Align, Bgcolor, char, charoff, valign

Tr

Use CSS style sheets instead

Align, Char, charoff, valign, width

Col, colgroup

Use CSS style sheets instead

Align, Border, hspace, vspace

Object

Use CSS style sheets instead

Clear

Br

Use CSS style sheets instead

Compace, Type

Ol, ul, li

Use CSS style sheets instead

Compace

Dl

Use CSS style sheets instead

Compace

Menu

Use CSS style sheets instead

Width

Pre

Use CSS style sheets instead

Align, Hspace, vspace

Img

Use CSS style sheets instead

Align, Noshade, size, width

Hr

Use CSS style sheets instead

Align, Frameborder, scrolling, marginheight, marginwidth

Iframe

Use CSS style sheets instead

Autosubmit

Menu

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.