Home Web Front-end H5 Tutorial A brief overview of the new and abolished attributes of html5_html5 tutorial skills

A brief overview of the new and abolished attributes of html5_html5 tutorial skills

May 16, 2016 pm 03:49 PM

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 of this Website
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

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to run the h5 project How to run the h5 project Apr 06, 2025 pm 12:21 PM

Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

What exactly does H5 page production mean? What exactly does H5 page production mean? Apr 06, 2025 am 07:18 AM

H5 page production refers to the creation of cross-platform compatible web pages using technologies such as HTML5, CSS3 and JavaScript. Its core lies in the browser's parsing code, rendering structure, style and interactive functions. Common technologies include animation effects, responsive design, and data interaction. To avoid errors, developers should be debugged; performance optimization and best practices include image format optimization, request reduction and code specifications, etc. to improve loading speed and code quality.

How to make h5 click icon How to make h5 click icon Apr 06, 2025 pm 12:15 PM

The steps to create an H5 click icon include: preparing a square source image in the image editing software. Add interactivity in the H5 editor and set the click event. Create a hotspot that covers the entire icon. Set the action of click events, such as jumping to the page or triggering animation. Export H5 documents as HTML, CSS, and JavaScript files. Deploy the exported files to a website or other platform.

What is the H5 programming language? What is the H5 programming language? Apr 03, 2025 am 12:16 AM

H5 is not a standalone programming language, but a collection of HTML5, CSS3 and JavaScript for building modern web applications. 1. HTML5 defines the web page structure and content, and provides new tags and APIs. 2. CSS3 controls style and layout, and introduces new features such as animation. 3. JavaScript implements dynamic interaction and enhances functions through DOM operations and asynchronous requests.

How to make pop-up windows with h5 How to make pop-up windows with h5 Apr 06, 2025 pm 12:12 PM

H5 pop-up window creation steps: 1. Determine the triggering method (click, time, exit, scroll); 2. Design content (title, text, action button); 3. Set style (size, color, font, background); 4. Implement code (HTML, CSS, JavaScript); 5. Test and deployment.

What application scenarios are suitable for H5 page production What application scenarios are suitable for H5 page production Apr 05, 2025 pm 11:36 PM

H5 (HTML5) is suitable for lightweight applications, such as marketing campaign pages, product display pages and corporate promotion micro-websites. Its advantages lie in cross-platformity and rich interactivity, but its limitations lie in complex interactions and animations, local resource access and offline capabilities.

What Does H5 Refer To? Exploring the Context What Does H5 Refer To? Exploring the Context Apr 12, 2025 am 12:03 AM

H5referstoHTML5,apivotaltechnologyinwebdevelopment.1)HTML5introducesnewelementsandAPIsforrich,dynamicwebapplications.2)Itsupportsmultimediawithoutplugins,enhancinguserexperienceacrossdevices.3)SemanticelementsimprovecontentstructureandSEO.4)H5'srespo

Is H5 page production a front-end development? Is H5 page production a front-end development? Apr 05, 2025 pm 11:42 PM

Yes, H5 page production is an important implementation method for front-end development, involving core technologies such as HTML, CSS and JavaScript. Developers build dynamic and powerful H5 pages by cleverly combining these technologies, such as using the <canvas> tag to draw graphics or using JavaScript to control interaction behavior.

See all articles