0
First page paragraph comment
Html
3 Respostas
+ 3
visph Yes. HTML5 isn’t XML which has similar but not the same syntax. In XML <tag></tag> is the same as <tag/>, so in SVG, you can write <path points="" />. But HTML5 ignores slash before >, so in <script src="a"/><link rel="stylesheet" src="b"/> link tag is inside script tag. <script/>alert("a");</script> is also valid HTML5. Note: not tested in IE.
+ 1
HTML is usual, case insensitive, non-strict mark-up language. It means it’s not programming language, you don’t write commands — you write marks.
Almost each mark looks like this:
<element attribute(if any)="value">content</element>
Some tags are self-closing (empty), so mark looks like this:
<element attribute="value" />
But HTML5 isn’t so strict, so you must not write slash. (In HTML4, XHTML, SVG, MathML you must do it)
Each predefined element has unique name and predefined attributes.
Note:
In HTML5, you can add new elements which must contain hyphen (-) or own attribute which starts with data-.
+ 1
Tomáš Wróbel little correction to your answer: all versions of html (including html4) are as much permissive than html5 ;)
xhtml and all xml directly based languages (html is based on sgml, itself based on xml) aren't as much permissive (more strict) and requires the ending slash shortcut in empty tags (but could be wrote as <opentag></closetag> (obviously, with "opentag" and "closetag" as identical identifier ^^)... so it's the case for xml, xhtml (obsolete html branch based directly on xml), svg, mathml...