search
HomeWeb Front-endH5 TutorialA brief overview of the new and abolished attributes of html5_html5 tutorial skills

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

New attributes

1. Form-related attributes

Specify the autofocus attribute for input (type=text), select, textarea, and button. It allows the element to automatically gain focus when the screen is opened by specifying attributes. Specify the placeholder attribute for input (type=text) and textarea, which will prompt the user for input and what content the user can input. Specify form attributes for input, output, select, textarea, button, and fieldset. It declares which form it belongs to and then places it anywhere on the page without losing sight of the form. Specify the required attribute for input (type=text) and textarea. This attribute indicates that the user will check when submitting, and check that there must be input content in the element. Add several new attributes to the input tag: autocomplete, min, max, multiple, pattern and step. There is also a list attribute used in conjunction with the datalist element; the datalist element is used in conjunction with the autocomplete attribute. The multiple attribute allows multiple files to be uploaded at one time during upload; the pattern attribute is used to verify 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 numbers should be -3, 0, 3, 6, and so on). The step attribute can be used in conjunction with the max and min attributes to create legal range of values. Add formaction, formenctype, formmethod, formnovalidate and formtarget attributes to input and button elements. The user overrides the action, enctype, method, novalidate and target attributes of the form element. Add the disabled attribute to the fieldset element to set its child elements to the disabled state. Adding the novalidate attribute to input, button, and form can cancel the relevant checks performed during submission, and the form can be submitted unconditionally.

2. Link related attributes

Add media attributes to a and area. Specifies the type of media/device the target URL is optimized for. This attribute is used to specify that the target URL is designed for a particular device (such as iPhone), voice or print media. This property can accept multiple values. Can only be used when the href attribute is present. Add herflang and rel attributes to area. The hreflang attribute specifies the language of the text in the linked document. This attribute can only be used when the href attribute is set. Note: This property is purely advisory. The rel attribute specifies the relationship between the current document and the linked document/resource. The rel attribute can only be used when using the href attribute. Add size attribute to link. The sizes attribute specifies the size of the linked resource. This attribute can only be used when the linked resource is an icon (rel="icon"). This property can accept multiple values. Values ​​are separated by spaces. Adding the target attribute to the base element is mainly to maintain consistency with the a element.

3. Other attributes

Add the reversed attribute to ol, which specifies that the list is displayed in reverse order. Add the charset attribute to meta and add type and label attributes to menu. label defines a courseware label for the menu, and the type attribute allows it to appear in three forms: context menu, toolbar, and list. Add scoped attribute to style. It allows us to define styles for specified parts of the document instead of the entire document. If the "scoped" attribute is used, the specified style can only be applied to the parent element of the style element and its children. Add or subtract attributes for script, which defines whether the script is executed asynchronously. The async attribute only works with external scripts (only when using the src attribute). There are several ways to execute external scripts: If async="async": the script executes asynchronously with respect to the rest of the page (while the page continues parsing, the script will be executed) If async is not used and defer="defer": the script will be executed when the page has finished parsing. If neither async nor defer is used: the script is read and executed immediately before the browser continues to parse the page as an html element. Add manifest, which is used in conjunction with the API when developing offline web applications to define a URL and describe the cache information of the document on this URL. Add attributes to iframe, sandbox, seamless, srcdoc. Used to improve page security and prevent untrusted web pages from performing certain operations.

Abolished attributes

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

Attributes used in HTML 4 Elements using this attribute Alternatives in HTML 5
rev link, a rel
charset link, a Use the HTTP Content-type header element in the linked resource
shape, coords a Use area element instead of a element
longdesc img, iframe Use the a element to link to the principal description
target link Redundant attributes, omitted
nohref area Redundant attributes, omitted
profile head Redundant attributes, omitted
version html Redundant attributes, omitted
name img id
scheme meta Use scheme only for certain form fields
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 Use name and value attributes, do not declare the MIME type
axis, abbr td、th Use a format that begins with clear, concise text, followed by detailed text.You can use the title attribute for more detailed content to make the cell content shorter
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 stylesheet instead
alink, link, text, vlink, background, bgcolor body Use CSS stylesheet instead
align, bgcolor, border, cellpadding, cellspacing, frame, rules, width table Use CSS stylesheet instead
align, char, charoff, height, nowrap, valign tbody, thead, tfoot Use CSS stylesheet instead
align, bgcolor, char, charoff, height, nowrap, valign, width td、th Use CSS stylesheet instead
align, bgcolor, char, charoff, valign tr Use CSS stylesheet instead
align, char, charoff, valign, width col, colgroup Use CSS stylesheet instead
align, border, hspace, vspace object Use CSS stylesheet instead
clear br Use CSS stylesheet instead
compace, type ol, ul, li Use CSS stylesheet instead
compace dl Use CSS stylesheet instead
compace menu Use CSS stylesheet instead
width pre Use CSS stylesheet instead
align, hspace, vspace img Use CSS stylesheet instead
align, noshade, size, width hr Use CSS stylesheet instead
align, frameborder, scrolling, marginheight, marginwidth iframe Use CSS stylesheet instead
autosubmit menu
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
How to Add Audio to My HTML5 Website?How to Add Audio to My HTML5 Website?Mar 10, 2025 pm 03:01 PM

This article explains how to embed audio in HTML5 using the <audio> element, including best practices for format selection (MP3, Ogg Vorbis), file optimization, and JavaScript control for playback. It emphasizes using multiple audio f

How do I use the HTML5 Page Visibility API to detect when a page is visible?How do I use the HTML5 Page Visibility API to detect when a page is visible?Mar 13, 2025 pm 07:51 PM

The article discusses using the HTML5 Page Visibility API to detect page visibility, improve user experience, and optimize resource usage. Key aspects include pausing media, reducing CPU load, and managing analytics based on visibility changes.

How do I use viewport meta tags to control page scaling on mobile devices?How do I use viewport meta tags to control page scaling on mobile devices?Mar 13, 2025 pm 08:00 PM

The article discusses using viewport meta tags to control page scaling on mobile devices, focusing on settings like width and initial-scale for optimal responsiveness and performance.Character count: 159

How to Use HTML5 Forms for User Input?How to Use HTML5 Forms for User Input?Mar 10, 2025 pm 02:59 PM

This article explains how to create and validate HTML5 forms. It details the <form> element, input types (text, email, number, etc.), and attributes (required, pattern, min, max). The advantages of HTML5 forms over older methods, incl

How do I handle user location privacy and permissions with the Geolocation API?How do I handle user location privacy and permissions with the Geolocation API?Mar 18, 2025 pm 02:16 PM

The article discusses managing user location privacy and permissions using the Geolocation API, emphasizing best practices for requesting permissions, ensuring data security, and complying with privacy laws.

How to Create Interactive Games with HTML5 and JavaScript?How to Create Interactive Games with HTML5 and JavaScript?Mar 10, 2025 pm 06:34 PM

This article details creating interactive HTML5 games using JavaScript. It covers game design, HTML structure, CSS styling, JavaScript logic (including event handling and animation), and audio integration. Essential JavaScript libraries (Phaser, Pi

How do I use the HTML5 Drag and Drop API for interactive user interfaces?How do I use the HTML5 Drag and Drop API for interactive user interfaces?Mar 18, 2025 pm 02:17 PM

The article explains how to use the HTML5 Drag and Drop API to create interactive user interfaces, detailing steps to make elements draggable, handle key events, and enhance user experience with custom feedback. It also discusses common pitfalls to a

How do I use the HTML5 WebSockets API for bidirectional communication between client and server?How do I use the HTML5 WebSockets API for bidirectional communication between client and server?Mar 12, 2025 pm 03:20 PM

This article explains the HTML5 WebSockets API for real-time, bidirectional client-server communication. It details client-side (JavaScript) and server-side (Python/Flask) implementations, addressing challenges like scalability, state management, an

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool