HTML and CSS Reference
In-Depth Information
HTML, it needs to parse it using an HTML parser that adheres to the HTML specifica-
Before I continue, let me clarify the major difference between XHTML and HTML.
Although they share a common vocabulary, XHTML has several theoretical advantages
over HTML, including the following:
• XHTML that is not well-formed will be immediately spotted, because
browsers will refuse to display the page and will display an error in-
• XHTML provides a guarantee of a well-formed 2 document.
Neither of the preceding points is true, however, unless the pages are serving XHTML
with a MIME type of “application/xhtml+xml” or “application/xml.” If your web server
is serving your web pages with a MIME type of “text/html,” then you will not be taking
full advantage of XHTML.
Deciding between HTML and XHTML
So, which should you use, HTML5 or XHTML5? It depends on your syntactic prefer-
ences and how important the guarantee of well-formedness in your documents is to you.
XML-style syntax can still be used in HTML, but don't expect it to have the implications
of XHTML unless it is served as such. Ultimately, it's a judgment call entirely depend-
ent on your own circumstances. Just don't make the mistake of thinking that by serving
a page as XHTML you've done all you need to do to create a professional, well-struc-
tured, semantically meaningful document.
Web browser support
Whichever syntax you use, let's turn to how you see the fruits of your labor. As
features of HTML5 become stable, they are—in a perfect world—expected to appear
in the latest version of your preferred web browser. But how do you know which
features are actually supported and which are not? Testing code in the browser you
are developing against is the surest option, but there are also websites such as ht-
tp:// available that give you an idea of what your preferred browser
supports. Another site, , detects whether certain features
are available in the browser used to visit the site ( Figure 1-5 ) . Use a different browser,
and you may see a different score and summary, highlighting that not all features will
work on all major browsers.
Search WWH ::

Custom Search