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 you can.
Browser: Being a browser is tough these days...
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
Head First: So what’s the big deal? What does it
really matter which version of HTML I use?
Browser: Remember the browser wars? All kinds
of elements were added to HTML that we aren’t
supposed to use anymore. But some people expect us
browsers to be able to display them anyway, and we
don’t always agree on how that should be done.
Head First: Why aren’t we supposed to use those
elements any more?
Browser: Well, before CSS was invented, HTML
had elements that were there for presentation, not
structure. Now, with CSS, we don’t need those
anymore, but there are still plenty of Web pages out
there that use them.
Head First: I think I’m starting to see the problem.
So how do you manage to display all these pages in
all these different versions of HTML? That’s quite a
Browser: Yeah, like I said, it’s tough being a
browser. What we end up doing is having two sets of
rules for displaying Web pages: one for old HTML
and one for the newer, standard HTML. When I use
the old rules, I call that my “quirks mode” because
there are so many weird things that can happen on
Head First: That sounds like a pretty good
solution to me...
Browser: Well, it can get you into trouble, though.
If you’re writing new HTML, but you don’t tell me
you’re writing new HTML, then I have to assume
you’re writing old HTML, and go into quirks mode
just in case. And you don’t want that.
Head First: What do you mean?
Browser: Not all browsers agree on how to display
the older stuff, but we all do a pretty consistent job
with standard HTML. So if you’re using standard
HTML, tell me and you’ll get more consistent results
in all browsers.
Head First: Oh, so you can end up using the
quirks mode rules on the pages written using new
Browser: Exactly. If I don’t know you’re writing
new HTML, I go into my quirks mode and do the
best I can. But, you don’t want that because all those
“quirks” mean that your pages might end up looking
a bit off, when they could have looked beautiful if I’d
only known you were using new HTML.
Head First: Ahh. So, what’s the solution to this
mess? We deﬁnitely want our Web pages to look
Browser: Easy. Tell me up front which version of
HTML you’re using. That way I know which rules
to use to display your page.
Head First: Got it. Thank you, Browser!
This week’s interview:
Why do you care which version
of HTML you’re displaying?
The Browser Exposed
browsers and quirks mode