This tutorial introduced you to XHTML and then explored the relationship between HTML and XHTML. You learned about the origins of both languages and why XHTML has long-term benefits that make it an ideal successor to HTML. The tutorial shifted gears toward the practical by showing you how to create and validate XHTML documents. You then finished up the tutorial by learning how to migrate legacy HTML documents to XHTML.
Q&A
Q. |
If web browsers don't know how to display XML documents, how is it that XHTML documents can be viewed in web browsers? |
A. |
XHTML represents the one exception to the rule about XML documents not being viewable without the aid of stylesheets. Because HTML documents are directly viewable in web browsers, even without the help of stylesheets, it only makes sense that XHTML documents should be viewable as well. However, you still must use stylesheets if you want control over the layout and formatting details of XHTML documents. |
Q. |
What happens if I don't validate my XHTML documents? |
A. |
Nothing happens, as least for now. Web browsers currently treat XHTML documents with the same leniency that they handle HTML documents, so you can get away with creating invalid documents if you want. However, this goes against the whole premise of XHTML, which is to demand the creation of highly accurate documents. The idea is that browsers and web-based applications may at some point validate XHTML documents. So you should make an effort to police your own documents and make sure they are valid before publishing them on the Web. |