HTML5: Where is the spec for which end tags are forbidden?

安稳与你 提交于 2019-12-05 14:47:35
Mikko Ohtamaa

When and how optional end tags should behave, in HTML5 spec:

http://www.w3.org/TR/html5/syntax.html#void-elements

8.1.2 Elements

Void elements only have a start tag; end tags must not be specified for void elements.

Void Elements

  • area
  • base
  • br
  • col
  • command
  • embed
  • hr
  • img
  • input
  • keygen
  • link
  • meta
  • param
  • source
  • track
  • wbr

A more concise form:

Element Type    Start Tag  End Tag
=============== =========  =========
Normal          -          O (some)
   html         O*         O*
   head         O*         O*
   body         -          O*
   li           -          O*
   dt           -          O*
   dd           -          O*
   p            -          O*
   rt           -          O*       
   rp           -          O*
   optgroup     -          O*
   option       -          O*
   colgroup     O*         O*
   thead        -          O*
   tbody        -          O*
   tfoot        -          O*
   tr           -          O*
   td           -          O*
   th           -          O*
   otherwise    -          -
Raw text        -          -
   script
   style
RCDATA          -          -
   textarea
   title
Void            -          F
   area
   base
   br
   col
   command
   embed
   hr
   img
   input
   keygen       
   link
   meta
   param
   source
   track
   wbr
Foreign         -          -          
   MathML
   SVG
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!