pair.
♦ You can incorporate other elements. Unlike the Input button, you can place images or styled text inside a button. This gives you some other capabilities. The second button in the buttons.html example uses a small GIF image to create a more colorful button.
Chapter 8: The Future of HTML: HTML 5
In This Chapter
Previewing HTML 5
Using new semantic markup tags
Embedding fonts
Using the new canvas tag for custom graphics
Audio and video support
Advanced features
The Web world is always changing. A new version of HTML — HTML 5 — is on the horizon, and it has some very interesting features. In this chapter, I preview the new features in HTML 5 and show you a few examples. When HTML becomes the standard, you’ll be ahead of the game.
Can’t We Just Stick with XHTML?
XHTML is great. When you add CSS to it, you can do a lot with XHTML. However, it isn’t perfect. The Web is evolving, and we’re now commonly doing things with Web pages that were once unheard of:
♦ Sophisticated structure: Web-based documents frequently have navigation elements, footer elements, page sections, and individual articles. Developers often use many variations of the
tag to manage these elements. HTML 5 has them built in.
♦ Multimedia: It’s now common for Web pages to incorporate audio and video, yet these elements aren’t built into HTML like image support. Instead, developers have to rely on external software, such as Flash.
♦ Vector/real-time graphics: The graphics capabilities of current browsers are fine, but they don’t allow real-time modification. Programmers often use third-party software, such as Flash or Silverlight, to bring in this capability.
♦ Enhanced programming: Developers are no longer satisfied with Web pages as documents. Today’s Web pages are the foundation of entire applications. Developers (and their customers) want advanced capabilities, such as dragging and dropping, local data storage, and geolocation (a fancy term for a browser that can tell where the device using the page is in the world).
Using the HTML 5 doctype
The XHTML doctype is remarkably ugly. I’ll be honest. I can’t code it from memory, and I write books about this stuff. My favorite part about HTML 5 might be the sensible doctype:
That’s it. No messy XMLNS business, no crazy URLs, no http-equiv nonsense. Just . This replaces both the and the tags. It’s beautiful, in a geeky sort of way.You might still want to add this line inside your heading:
It specifies the character set as a standard text encoding. Typically, the server sends this, so it isn’t really necessary, but including the line eliminates a possible validator warning that no typeface was defined.
Browser support for HTML 5
Before you get too excited about HTML 5, you have to realize it’s still experimental. All the examples in this chapter were tested in Firefox 3.5, which supports many HTML 5 features. The