HTML5學習筆記簡明版(10):廢棄的元素和屬性
2011-12-17 20:36 湯姆大叔 閱讀(4705) 評論(0) 收藏 舉報廢棄的元素(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 |
本章節列出的元素在HTML5里將不再使用,現有文檔升級到 HTML5的話可以使用一些替代方案。例如parser section 可以處理isindex 元素的功能。另外,HTML4里的一些屬性不會再被允許在HTML5里使用了,規范里詳細說明了如何處理現有的文檔,并且以后新文檔不能再使用這些屬性,因為他們會標記成不合法的屬性。但是HTML5提供了相應的替代方案供開發人員使用。
浙公網安備 33010602011771號