XML-compatible Empty Tags?

Hello,

I'm teaching Web design to my high school classes, and I ask my kids to 
design their Web pages so that they will validate as HTML 4.01 Strict. But 
I also am thinking in terms of forward compatibility with XHTML, so I have 
asked them to write empty tags to be self-closing, as: <br />, <hr /> and 
<img />.

Trouble is, These tags produce errors with the HTML 4.01 Strict Validator.

In the "Compatibility Guidelines" section of the W3C document, "XHTML 1.0 
The Extensible HyperText Markup Language (Second Edition)" document (found 
at www.w3.org/TR/xhtml1/), in section 5.C.2, "Empty Elements," it states:

"Include a space before the trailing / and > of empty elements, e.g. <br 
/>, <hr /> and <img src="karen.jpg" alt="Karen" />. Also, use the minimized 
tag syntax for empty elements, e.g. <br />, as the alternative syntax 
<br></br> allowed by XML gives uncertain results in many existing user 
agents."

What's the problem here, and what should I do about it?

Charlie Walker

-- 
 

Received on Saturday, 8 March 2003 09:28:45 UTC