Pages

Monday, December 26, 2011

Make your XHTML backward-compatible with Appendix C

Sometimes you'll hear about various appendices in discussions about the Web standards on the W3C site (www.w3.org). These appendices are simply portions of a given specification. Appendix C (www.w3.org/TR/xhtml1/#guidelines) is the portion of the XHTML 1.0 standard that talks about how to make XHTML backward-compatible with browsers intended to interpret HTML. The recommendations in Appendix C provide a way to make a smoother, easier transition between HTML and XHTML.

One of key points is that if you use the XHTML shorthand for empty elements, you should insert a space between the element name and the closing slash--i.e.,

<br />

instead of

<br/>

If the element is one that wouldn't typically be expected to be empty, then use the full form:

<title></title>

Also, to make XHTML display on older browsers properly, you may need to use a meta tag with the http-equiv and content attributes, which also allows you to define a given character set, like so:

<meta http-equiv="Content-type" content="text/html; charset=EUC-JP" />


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.