The syntax is valid in some places but doesn't mean the same as in XHTML, so don't use them.
In HTML 4 <foo />
(where foo is the name of an element defined as EMPTY) means the same as <foo>>
which means the same as <foo>>
(although almost no browser supports the syntax correctly, Emacs-W3 used to, but broke compatibility with the standard in favour of rendering so-called HTML compatible XHTML 1.0 documents correctly).
This is, therefore, valid in places where you can have a >
such as anywhere you are allowed an <img>
but not in other places (such as an <hr>
that is a child element of the <body>
(in Strict)).
The interaction with the rules for optional start and end tags adds more complication. In a Transitional document, this is valid:
<link …/>
<h1>Hello, world</h1>
and means:
<link>
</head>
<body>
>
<h1>Hello, world</h1>
This shorthand syntax could be useful, or at least a time saver, for things like:
<title/The quick brown fox/
instead of the more verbose:
<title>The quick brown fox</title>
… but the syntax has never been well supported and the specification says it should be avoided.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…