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 new and abolished properties of html5?

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

Share

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

What are the new and abolished attributes of html5? I believe many inexperienced people don't know what to do about it. Therefore, this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

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

New properties

1. Form-related properties

Specify the autofocus attribute for input (type=text), select, textarea, and button. It automatically gives the element focus when the screen is opened by specifying attributes. Specify the placeholder attribute for input (type=text) and textarea, which prompts the user for input and prompts for what the user can enter. Specify the form attribute for input, output, select, textarea, button, and fieldset. It declares which form it belongs to and places it anywhere on the page without losing it within the form. Specify the required attribute for input (type=text) and textarea. This attribute indicates that when the user submits, it is checked that there must be input in the element. Add several new attributes to the input tag: autocomplete, min, max, multiple, pattern, and step. There is also the list attribute used with the datalist element, and 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 validate the pattern of the input field, which is actually a regular expression. The step attribute specifies the legal number interval of the input field (if step= "3", the legal number should be-3, 0, 3, 6, and so on), and the step attribute can be used with the max and min properties to create a range of legal values. Add formaction, formenctype, formmethod, formnovalidate and formtarget attributes to the input and button elements. The user overloads the action, enctype, method, novalidate, and target attributes of the form element. By adding a disabled attribute to the fieldset element, you can set its child elements to the disabled state. Add the novalidate attribute to input, button, and form to cancel the check on submission, and the form can be submitted unconditionally.

2. Link-related attributes

Add media attribute to an and area. Specify what type of media / devices the target URL is optimized for. This attribute is used to specify that the target URL is designed for special devices (such as iPhone), voice, or print media. This property can accept multiple values. Can only be used when the href property exists. Add herflang and rel attributes to area. The hreflang attribute specifies the language of the text in the linked document. This property can be used only if the href property is set. Note: this attribute is purely advisory. The rel attribute specifies the relationship between the current document and the linked document / resource. The rel property can only be used when the href property is used. Add the size attribute to link. The sizes attribute specifies the size of the linked resource. This property can be used only if 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, mainly to maintain consistency with the an element.

3. Other attributes

Add the reversed attribute to ol, which specifies that the list is displayed in reverse order. Add charset attributes for meta and type and label attributes for menu. Label defines a courseware annotation for the menu, and the type attribute allows the talent to appear in three forms: context menu, toolbar and list cande. Add the scoped attribute to style. It allows us to define styles for a specified part of the document, rather than the entire document. If you use the "scoped" attribute, the specified style can only be applied to the parent element of the style element and its children. Adds or subtracts attributes to script, which defines whether the script executes asynchronously. The async attribute applies only to external scripts (only when using the src attribute) there are several ways to execute external scripts: if async= "async": the script executes asynchronously relative to the rest of the page (when the page continues to parse, the script will be executed) if not using async and defer= "defer": the script will be executed when the page finishes parsing if neither async nor defer is used: before the browser continues to parse the page Immediately read and execute the script to add manifest to the html element, and he uses it in conjunction with API when developing offline web applications to define a URL that describes the document's cache information on this URL. Add attributes to iframe: sandbox, seamless, srcdoc. Used to improve page security and prevent untrusted web pages from performing certain actions.

The attribute of abrogation

Some attributes in HTML4 are no longer used in HTML5, but are replaced by other attributes or in other ways.

The attribute used in HTML 4 uses the alternative of the element of this attribute in HTML 5 revlink, arelcharsetlink, a uses the HTTP Content-type header element shape in the linked resource, coordsa uses the area element instead of an element longdescimg, iframe uses the an element to link to the principal to describe the targetlink redundant attribute, the nohrefarea redundant attribute is omitted, the profilehead redundant attribute is omitted, and the versionhtml redundant attribute is omitted. The omitted nameimgidschememeta only uses schemearchive, chlassid, codebose, codetype, declare, standbyobject to invoke the plug-in using the data and typc attribute classes for a form field. When you need to use these properties to set parameters, use the param property valuetype, typeparam use the name and value properties, the undeclared MIME types axis, abbrtd, th use the form that begins with clear and concise text, followed by detailed text. You can use the title property for more details Scopetd uses HTTP Content-type header elements aligncaption, input, legend, div, H2, h3, h4, h5, h6, h7, p in linked resources to replace alink, link, text, vlink, background, bgcolorbody with CSS stylesheets instead of align, bgcolor, border, cellpadding, cellspacing, frame, rules, widthtable uses CSS stylesheets instead of align, char, charoff, height, nowrap, valigntbody, thead, tfoot uses CSS stylesheets instead of align, bgcolor, char, rules Charoff, height, nowrap, valign, widthtd, th use CSS stylesheets instead of align, bgcolor, char, charoff, valigntr use CSS stylesheets instead of align, char, charoff, valign, widthcol, colgroup use CSS stylesheets instead of align, border, hspace, vspaceobject use CSS stylesheets instead of clearbr using CSS stylesheets instead of compace, typeol, ul, li use CSS stylesheets instead of compacedl using CSS stylesheets instead of compacemenu using CSS stylesheets instead of CSS, widthpre stylesheets Vspaceimg uses CSS stylesheets instead of align, noshade, size, widthhr. Use CSS stylesheets instead of align, frameborder, scrolling, marginheight, marginwidthiframe. Use CSS stylesheets instead of autosubmitmenu. Have you mastered the methods of adding and abolishing properties of html5? 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