HTML and CSS Reference
Q: The validator says it is experimental for HTML5. What
does that mean?
A: The message “Using experimental feature: HTML5
Conformance Checker” in the validator means that the validator is
checking your HTML according to the HTML5 standard, but because
the HTML5 standard isn't final (and still has new features being
added), the validator is prone to change, so the results you get
when you validate your page aren't set in stone. That means, as a
conscientious developer, it's in your best interest to stay up-to-date
on the HTML standard, and check your pages fairly regularly.
Q: What have we really achieved in this chapter? My page
still looks the same.
A: In this chapter we've tweaked your page slightly so that it is
compliant with the HTML specification. What good is that? The closer
you are to the spec, the more likely that your page is going to perform
well in the real world. If you're producing a professional web page,
you want it to be written using the industry standard, and that's what
we've done in this chapter by adding a doctype, setting a character
encoding, and cleaning up an oversight (the alt attribute) in the HTML.
Q: Why do we need that alt attribute anyway?
A: For two great reasons. First, if your image is broken for some
reason (say, your image server goes down, or your connection is
really slow), the alt attribute will (in most browsers) show the alt text
you've specified in place of the image. Second, for vision-impaired
users who are using a screen reader to read the page, the screen
reader will read the alt text to the user, which helps them understand
the page better.
Q: What if I tell the browser I'm using HTML5, and I'm not?
A: The browser will figure out that you're not really writing HTML5
and use the error handling capabilities it has to try to do the right
thing. And then you're back to the problem of having the various
browsers handle your page in different ways. The only way you can
get predictable results is to tell the browser you're using HTML5 and
to actually do so, properly.
Q: We talked a little about HTML5, but I want make sure I'm
clear: is there any difference between the HTML we're writing
A: We're using standard HTML, which is HTML5. Now, HTML5
introduced some new markup (which we'll be seeing soon enough)
as well as support for writing web applications (which we won't be
doing in this topic), but HTML5 is HTML, and everything you've
been writing is HTML5 “compliant.” So, sorry for the terminology, but
going forward everything is just HTML, including all the new features
provided by the HTML5 specification.
The good news is that everything you've learned is all ready for
HTML5, and in fact you see how little you actually had to do to go
from an “informal HTML” page to a professional HTML page. That
said, you might want to tell your boss you're already using HTML5
just for bonus points toward your next raise.
Q: What's the big deal with HTML5 compared to HTML 4.01
A: The big deal about HTML5 is threefold. First, there are some
new elements and attributes in HTML5 that are pretty cool (like the
<video> element), and others that will help you write better pages
(we'll be getting to those later in the topic).
Second, there are many new features that allow web developers
to create web applications with HTML5. Web applications are web
pages that behave more like applications (like the ones you're used
to using on your laptop or mobile device) than static web pages. If
you're interested in creating web applications, then after you're all
done with this topic (cue shameless plug), you should check out
Head First HTML5 Programming (O'Reilly).
Finally, the HTML5 specification is a lot more robust than the
specifications for the previous versions of HTML. Remember how we
said that the specification is now documenting common errors that
web developers make? And helping browsers to know how to handle
those errors? That means that web pages with errors on them don't
cause the havoc they used to, which is a good thing for users.
All in all, HTML5 is a big improvement over HTML 4.01, and well
worth learning. We'll get you up to speed quickly over the next few