关于HTML(七)--------HTML废弃的标签

html5废弃元素

表现性元素

下面的元素被废弃的原因是用CSS处理可以更好地替代他们:

  1. basefont
  2. big
  3. center
  4. font
  5. strike
  6. tt

框架类元素

下面的元素被废弃的原因是他们的使用破坏了可使用性和可访问性(但html5支持iframe):

  1. frame
  2. frameset
  3. noframes

其他

下面的元素被废弃的原因是不经常使用他们,也会引起混乱,而且其它元素也可以很好地实现他们的功能:

  • acronym被废弃是因为它经常使页面错乱,可以使用abbr代替
  • applet被废弃是因为可以使用object代替
  • isindex被废弃是因为使用表单控件代替
  • dir被废弃是因为使用ul代替

html5废弃属性

对应替代方案:https://html.spec.whatwg.org/multipage/obsolete.html#non-conforming-features

对应元素

属性名称

link, a

rev, charset

a

shape, coords

img, iframe

longdesc

link

target

area

nohref

head

profile

html

version

img

name

meta

scheme

object

archive, classid, codebase, codetype, declare, standby

param

valuetype, type

td, th

axis, abbr

td

scope

table

summary

以下元素的视觉属性也被废弃,可用CSS来代替:

对应元素

属性名称

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

body

alink, link, text, vlink

body

background

table, tr, td, th, body

bgcolor

object

border

table

cellpadding, cellspacing

col, colgroup, tbody, td, tfoot, th, thead, tr

char, charoff

br

clear

dl, menu, ol, ul

compact

table

frame

iframe

frameborder

td, th

height

img, object

hspace, vspace

iframe

marginheight, marginwidth

hr

noshade

td, th

nowrap

table

rules

iframe

scrolling

hr

size

li, ol, ul

type

col, colgroup, tbody, td, tfoot, th, thead, tr

valign

hr, table, td, th, col, colgroup, pre

width