html - Why some HTML5 tags must have a starting and ending tag instead of self closing them with />? -
in html5 there tags must have starting , ending tag when content empty:
<script></script> <!-- right way. --> <div></div> <!-- right way. --> <content></content> <!-- right way. --> <script/> <!-- wrong way. --> <div/> <!-- wrong way. --> <content/> <!-- wrong way. -->
in xml difference doesn't exist: <node/>
, <node></node>
same entity.
why tags script
, div
, content
can't defined as: <script/>
, <div/>
, <content/>
?
a self-closing tag special form of start tag slash before closing right angle bracket. these indicate element closed immediately, , has no content. syntax permitted , used, end tag must omitted. in html, use of syntax restricted void elements , foreign elements. if used other elements, treated start tag. in xhtml, possible element use syntax. note conforming elements content models permit them empty.
the examples listed contain content, javascript, or other elements, having proper start , end tag delimit scope of elements/tags.
Comments
Post a Comment