廢棄的元素(Element)
這個小節裏列出的元素在HTML5裏將不再使用,現有文檔升級到 HTML5的話可以使用一些替代方案。例如parser section 可以處理isindex 元素的功能。
下面的元素被廢棄的原因是用CSS處理可以更好地替代他們:
- basefont
- big
- center
- font
- strike
- tt
下面的元素被廢棄的原因是他們的使用破壞了可使用性和可訪問性:
- frame
- frameset
- noframes
下面的元素被廢棄的原因是不經常使用他們,也會引起混亂,而且其它元素也可以很好地實現他們的功能:
- acronym被廢棄是因爲它經常使頁面錯亂,可以使用abbr代替
- applet被廢棄是因爲可以使用object代替
- isindex被廢棄是因爲使用表單控件代替
- dir被廢棄是因爲使用ul代替
最後,noscript元素只能在HTML裏使用,而不能在XML裏使用。
廢棄的屬性(Attribute)
HTML4裏的一些屬性不會再被允許在HTML5裏使用了,規範裏詳細說明了如何處理現有的文檔,並且以後新文檔不能再使用這些屬性,因爲他們會標記成不合法的屬性。
HTML5的規範裏有對這些屬性的代替方案,點擊訪問。
ID |
對應元素 |
屬性名稱 |
01 |
link, a |
rev, charset |
02 |
a |
shape, coords |
03 |
img, iframe |
longdesc |
04 |
link |
target |
05 |
area |
nohref |
06 |
head |
profile |
07 |
html |
version |
08 |
img |
name |
09 |
meta |
scheme |
10 |
object |
archive, classid, codebase, codetype, declare, standby |
11 |
param |
valuetype, type |
12 |
td, th |
axis, abbr |
13 |
td |
scope |
14 |
table |
summary |
另外, 在HTML5裏,以下元素的視覺屬性也將被廢棄,因爲這些功能可用CSS來實現:
ID |
對應元素 |
屬性名稱 |
01 |
caption, iframe, img, input, object, legend, table, hr, div, h1, h2, h3, h4, h5, h6, p, col, colgroup, tbody, td, tfoot, th, thead, tr |
align |
02 |
body |
alink, link, text, vlink |
03 |
body |
background |
04 |
table, tr, td, th, body |
bgcolor |
05 |
object |
border |
06 |
table |
cellpadding, cellspacing |
07 |
col, colgroup, tbody, td, tfoot, th, thead, tr |
char, charoff |
08 |
br |
clear |
09 |
dl, menu, ol, ul |
compact |
10 |
table |
frame |
11 |
iframe |
frameborder |
12 |
td, th |
height |
13 |
img, object |
hspace, vspace |
14 |
iframe |
marginheight, marginwidth |
15 |
hr |
noshade |
16 |
td, th |
nowrap |
17 |
table |
rules |
18 |
iframe |
scrolling |
19 |
hr |
size |
20 |
li, ol, ul |
type |
21 |
col, colgroup, tbody, td, tfoot, th, thead, tr |
valign |
22 |
hr, table, td, th, col, colgroup, pre |
width |