Why Use HTML5 to Build Web Pages?

HTML5, the current (albeit still-changing) version of HTML is actually more widely supported, including in older browsers (such as Internet Explorer 6, 7, and 8), than its predecessors.

Here’s the essential point to understand about HTML5: About 99 percent of HTML5 involves the same set of elements that were used by its predecessors, HTML4 and XHTML. Those elements worked in HTML4, worked in XHTML, and still work in HTML5. In short, when you create pages in HTML5, you’re just creating HTML pages, period.

The other dimension to HTML5, though, is that it introduces some new elements. The most dramatic of these new elements are native video and named page structure elements.

Very briefly, native video allows video to play in web pages without plug-ins, additional software like the Flash Player or Windows Media Player or Appl QuickTime Player. And named page structure elements, like article, or header, tell a browser “this is an article” or “this is a page header,” respectively.

However, when you introduce new HTML5 tags, you’re creating pages that work best, or in some cases only work, in modern browsers.

The XHTML doctype (the version of HTML that preceded HTML5) should be avoided in most cases. The XHTML doctype that preceded HTML5 had stricter rules for page formatting. XHTML (so-named because it facilitated using data organized in a format called XML) made life easier for database programmers using XML (eXtensible Markup Language). But it made life more problematic for web page designers.

What kind of strict rules defined in XHTML interfered with browsers opening pages with flawed HTML code? If you forgot to close a paragraph element with a closing paragraph tag, for instance, XHTML would instruct a browser not to open the page, or if the page opened, to display an error message.

The stricter standard for HTML formatting associated with XHTML created annoying browsing experiences, with what appeared to be a barrage of unnecessary error messages popping up in browsers. These issues helped drive the emergence of the current version of HTML — HTML5.

The resolution of these “strict rules” issues in HTML5 has been to simplify HTML syntax, and loosen rules. With HTML5, leaving some tags unclosed is again allowable. (Having said that, best practice is still to close them; it doesn’t take a lot of work and helps keep code more organized and comprehensible for troubleshooting.)

Further, HTML5 has simplified the code required to define an HTML page. The first line of HTML5 page code is very simple:

<html>

Who should continue to use an XHTML doctype declaration at the beginning of an HTML file? The answer: designers working under the direction of XML database managers who insist that the XML element of the pages will only work if an XHTML doctype is declared. Such design environments are rare.

blog comments powered by Disqus
Advertisement

Inside Dummies.com