The Modern Web: A Book Review

  July 02, 2013

Peter Gasston likes gorillas. A lot. And he also has a passion for Web design. Mix those together, and you get The Modern Web, his new book on multi-device Web development using HTML5, CSS3, and JavaScript.

In just over 225 pages (including index and appendices), Gasston, the author of what may be the definitive book on CSS3 (The Book of CSS3: A Developer's Guide to the Future of Web Design, No Starch Press, ISBN: 978-1-59327-286-9), marches us through the various ins and outs of programming websites to accommodate everything from a smartphone to a tablet or a PC.

Gasston’s target audience isn't the neophyte Web developer. He assumes his reader has basic knowledge of HTML, CSS, and JavaScript, and builds on that knowledge. But he doesn't assume you're up on the latest and greatest.

Chapter One just rounds up the ducks and gets them in a row. Gasston talks about what HTML5 actually is, what standards bodies are working on it, and its current status. He talks about best practices that have changed since HTML 4.01, and also includes a brief discussion of CSS3 versus CSS 2.1 and a bit about browsers.

But the key component of the chapter is the last section, where he talks about testing, testing, and more testing. Gasston says that 40-50% of build time in a multi-device project should be devoted to testing. That's the only way you can be sure your code will work on all devices.

So, now we leap into the nitty-gritty, right? Nope. The next chapter is all about structure and semantics. Without good structure, the author writes, your webpages will be harder to create and maintain, and they may not perform as well as they could. At this point, we do get into the new elements in HTML5, and see how they can create better webpages. And we see our first gorillas. A lot of the examples in the book involve gorillas.

Once the structure is sorted out, Gasston gets into device-responsive CSS. We've all experienced badly-coded pages that display microscopic text on smartphones, with layouts more suitable to larger screens. This chapter explains how to get your code to generate pages that are appropriate for various devices. And there are lots of ways to do so; Gasston discusses the pros and cons of each. With, yes, more gorillas.

From here we segue into JavaScript, with an overview of its most recently-added features and a chat about old and new ways of doing things like initiating scripts. Touch and pointer events get some attention, and then Gasston turns to the various libraries that help with some of the messier bits of producing pages. He finishes up with a quick peek at polyfills and shims that persuade browsers to perform new functions that they don't natively support, along with a bit more information on testing and debugging.

Mobile devices have a lot of functionality that your garden-variety laptop can't even dream of. The next section of the book describes some of the APIs that let developers make use of features like geolocation, orientation, vibration, battery status, camera and microphone, network information, and more. We also get a brief peek at a project called WebAPI, designed by Mozilla for its upcoming OS.

The next chapter is all about graphics: how to include, size, edit, and filter them. If I were the gorilla whose image was abused in this chapter, I'd do the author an injury – there are plenty of examples of what happens when you mess with images. We learn about the benefits of vector and bitmap graphics, especially scalable vector graphics (SVG). SVG has been around for a long time, says Gasston, but only became popular recently when Microsoft included it in Internet Explorer 9, and when the multi-device Web exploded.

Now we move on to a mix of items. Gasston describes all sorts of new forms and attributes, from autocomplete and datalists to widgets like date pickers and progress bars. We get into forms, including validation of inputs. And then we get an entire gorilla-free chapter on the handling of multimedia. Next up are Web apps. This is a short chapter that packs a lot into its few pages.

Finally, the book takes a look at the future of mobile Web development. Gasston describes experimental features that may (or may not) appear in standards and production Web browsers as time goes on. In the first appendix, he then talks about the state of each browser as of March 2013.

Throughout the volume, there are many code samples, all downloadable from the book's webpage, plus interjections of notes and warnings about oddities in various products and functions.

One of the best things about this book, however, isn't what's in it; it's what the author points us to. Web standards are volatile; Gasston is acutely aware that what was true at press time may be totally wrong in six months. He also doesn't claim to know it all, sprinkling citations and recommendations of other works where appropriate. The second appendix also lists a ton of additional resources, and each chapter contains links to reference material as well.

The Modern Web is not only a great reference, it's very readable. It's well indexed, the examples are short, sweet, and to the point, and the style is conversational. And, it has gorillas.

Want to check it out before you buy? No Starch offers a free chapter so you can tell if the book is written to your level.

The Modern Web, by Peter Gasston. No Starch Press. $34.95. ISBN: 978-1-59327-487-0.

See also: