Вы находитесь на странице: 1из 6

I

Changes between HTML4


and HTML5
This document outlines the major element differences between HTML4 and HTML5. For a
full view of all the changes, see the W3Cs document HTML5 Differences from HTML4 at
www.w3.org/TR/html5-diff/.

New Elements
The following list represents all the new elements introduced in HTML5. For descriptions of
these elements, see Appendix B, HTML Element Reference:

section

article

aside

hgroup

header

footer

nav

figure

figcaption

video

audio

track

embed

596

Appendix IChanges between HTML4 and HTML5

mark

progress

meter

time

ruby

rt

rp

bdi

wbr

canvas

command

cetails

catalist

keygen

output

New <input> Element Types


The input elements type attribute now has the following new values. For descriptions of these
elements, see Appendix B, HTML Element Reference:

tel

search

url

email

datetime

date

month

week

time

datetime-local

number

range

color

New Attributes

597

New Attributes
Many new attributes have been added to existing elements. These new attributes either are existing
attributes added to new elements or are completely new attributes. These are also covered in depth
alongside their elements in Appendix B, HTML Element Reference:
Element

Attributes

<a>

media

<area>

hreflang, media, rel, type

<base>

target

<button>

autofocus, form, formaction, formenctype, formmethod,


formnovalidate, formtarget

<fieldset>

disabled, form, name

<form>

novalidate

<html>

manifest

<iframe>

sandbox, seamless, srcdoc

<img>

crossorigin

<input>

autocomplete, autofocus, dirname, form, formaction,


formenctype, formmethod, formnovalidate, formtarget list,
max, min, multiple, pattern, placeholder, required, step,
height, width

<label>

form

<link>

sizes

<menu>

label, type

<meta>

charset

<object>

form, typemustmatch

<ol>

reversed

<output>

form

<script>

async

<select>

autofocus, form, required

<style>

scoped

<textarea>

autofocus, form, maxlength, placeholder, required,


wrap, dirname

598

Appendix IChanges between HTML4 and HTML5

Global Attributes
HTML5 greatly expands on the number of global attributes. The following list includes all the new
global attributes and the global attributes present in previous versions of HTML:

accesskey

class

contenteditable

contextmenu

dir

draggable

dropzone

hidden

id

lang

spellcheck

style

tabindex

title

translate

Changed Attributes
Several existing attributes have had their meanings changed:
Attribute

Element

Change

accept

<input>

audio/*, video/*, and image/* are now

valid values.
accesskey

global

Now allows multiple characters to be


specified.

action

<form>

No longer allowed to have an empty URL.

colspan

<td><th>

Now has to be greater than zero.

coords

<area>

No longer allows a percentage value of


the radius when the element is a circle.

Changed Attributes

599

data

<object>

No longer relative to the codebase.

defer

<script>

Explicitly executes the script when the


page has finished parsing.

dir

global

Now allows the value auto.

enctype

<form>

Now supports the value text/plain.

width/height

<img>, <iframe>,
<object>

No longer allowed to contain percentages. No longer allowed to stretch the


image to a different aspect ratio than its
intrinsic aspect ratio.

href

<link>

No longer allowed to have an empty URL.

href

<base>

Allowed to contain a relative URL.

Attributes that accept URLs

global

Now support IRIs if the documents encoding is UTF-8 or UTF-16.

http-equiv

<meta>

No longer said to be used by HTTP servers to create HTTP headers in the HTTP
response. Instead, it is said to be a pragma
directive to be used by the user agent.

id

global

Now allowed to have any unique value, as


long as it is not an empty string and does
not contain spaces.

lang

global

Takes the empty string in addition to a


valid language identifier.

media

<link>

Now accepts a media query. Defaults


to all.

Event handlers

global

Defaults to JavaScript as the scripting


language.

value

<li>

No longer deprecated.

start/type

<ol>

No longer deprecated.

style

global

Always uses CSS as the style language.

tabindex

global

Allows negative values, which indicates


that the element can receive focus but
cannot be tabbed to.

target

<a><area>

No longer deprecated.
continues

600

Appendix IChanges between HTML4 and HTML5

(continued)
Attribute

Element

Change

type

<script> <style>

No longer required if the scripting language is JavaScript and the styling


language is CSS, respectively.

usemap

img

No longer takes a URL, but instead


takes a valid hash-name reference to
a map element.

Obsolete Elements
The elements in this section are no longer part of the HTML specification:

basefont

big

center

font

strike

tt

frame

frameset

noframes

acronym

applet

isindex

dir

Obsolete Attributes
Some attributes from HTML4 are no longer allowed in HTML5:
Element

Attributes

<a>

charset, coords, rev, shape

<area>

nohref

Вам также может понравиться