Prev | Current Page 82 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

This type of fix is today considered archaic??”see Chapter 9 for modern
methods of backward compatibility, including conditional comments. For more on quirks
mode, read Wikipedia??™s article at http://en.wikipedia.org/wiki/Quirks_mode.
For the record, an example of an incomplete DTD looks like this:
"/DTD/xhtml1-transitional.dtd">
In this case, the URI (web address) is relative. Unless you have the DTD in the relevant
place on your own website, the browser will display the page this DTD is included on in
quirks mode. (And, quite frankly, if you do have the DTD on your website instead of using
the one on the W3C??™s site, you are very odd indeed.) The same thing happens if you leave
out DTDs entirely. Therefore, always include a DTD and always ensure it??™s complete.
What about the XML declaration?
As stated earlier, there is an exception to the DTD being the first thing on a web page. The
one thing that can precede it is an XML declaration (often referred to as the XML prolog).
This unassuming piece of markup looks like this (assuming you??™re using Unicode
encoding):

The tag tells the browser which version of XML is being used and that the character encoding
is UTF-8.
Some web design applications add this tag by default when creating new XHTML documents,
and the W3C recommends using it to declare the character encoding used within
your document.


Pages:
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94