HTML and CSS Reference
The Browser Exposed
This week's interview:
Why do you care so much about
which HTML version I'm using?
Head First: We're glad to have you here, Browser. As
you know, “HTML versions” have become a popular
issue. What's the deal with that? You're a web browser,
after all. I give you HTML and you display it the best
Head First: How do we tell you which version we're
using? Especially now that we're all moving on to
Browser: Well, HTML5 is actually making things a
Browser: Being a browser is tough…there are a lot
of web pages out there, and many are written with old
versions of HTML or with mistakes in their markup.
Like you said, my job is to try to display every single
one of those pages, no matter what.
Head First: Really? How is a new version of HTML
helping? I would have thought yet another version
would just make things even more difficult.
Browser: It's true that any new version of a language
causes growing pains as everyone tries to catch up with
the latest standard. But HTML5 simplifies the way you
tell me the kind of HTML you're using. The HTML5
standard is also documenting many of the errors that
can occur in web pages, so that all the browsers can be
more consistent about how they handle those errors.
Head First: So what's the big deal? You seem to be
doing a pretty good job of it.
Browser: In some cases, sure, but have you ever
looked at your pages on a lot of different browsers?
When you are using old or incorrect markup, your page
may look great on one browser, but not so great on
Head First: Oh, so does that mean we don't have
to worry about making errors when we're writing our
Head First: Really? Why is that? Don't you all do the
Browser: No! Just because we can handle errors
better doesn't mean you can be sloppy. You still want
your page to be consistent with the standard and
written without errors. If you don't, you might get
inconsistent results across browsers, and let's not forget
the browsers on mobile devices, too.
Browser: We do a great job of doing the same thing,
when we're displaying correct and up-to-date page s. Like I
said, when you venture into pages that aren't written
well, then things get a lot dicier. Here's why: all of us
browsers have the HTML specification to tell us how to
display correct HTML, but when it comes to incorrect
HTML, we just wing it. So, you might get very different
behaviors on different browsers.
Head First: Back to how we tell you what version
Browser: Yeah, that used to be a total pain in the…
Head First: Ahh. So, what's the solution to this mess?
We definitely want our pages to look good.
Head First: Uh, watch it, this is a PG-rated audience,
and we're running out of time, quickly!
Browser: Easy. Tell me up front which version of
HTML you're using. You'd be surprised how many
pages don't even do that. And make sure your page
doesn't contain any errors; you know, mismatched
markup tags, that kind of thing.
Browser: Okay, you can tell me all about the version
of HTML you're using with a doctype . It's a little bit
of “markup” you can use that goes at the very top of
your HTML file. So, given we're out of time, go check