Author’s Note: I’m currently in the process of migrating old blog posts to this new system. That may mean some links, syntax highlighting, and other details are broken or missing temporarily. Sorry for the inconvenience!

HTML doesn't fix things

2016-12-29

We've talked a bit already about what HTML is, but to recap: it's text that can link to other text, and also provides a way for us to make notes about it. Specifically, by surrounding parts of the text with fancy tags. Like <b>Hey, this text should be bold!</b>, or <i>Yo! This text should be italicized!</i>

Except…whoops. I did a bad thing. I typed <b>Hey, this text should be bold!</b> and your browser made it bold, but I really shouldn't have done that. <b> is technically still a valid tag, but it's one you're *heavily* discouraged from using. It exists because it exists in older versions of HTML. But I typed <!DOCTYPE html> at the top of this document, letting the browser know we're using HTML5! We shouldn't be using <b> and <i> tags!

It's dead language. Kinda like Latin. It's possible to tease out the meaning, if you're clever, but the terms aren't supposed to be in common use. Trouble is, it's very easy to make typing mistakes. And so a long time ago, browsers decided they'd just make their best guess at what you mean. Even if that means supporting old, dead tags like <b> — the long-ago shorthand for "bold".

So what's the new <b>?

So if <b> was retired, what was it's replacement? After all, we've been able to embolden, italicize, strikethrough, underline text for ages. And <b> seems so nice, short, and simple. How could they possibly shorten that?

Welp, they didn't. In fact, there *is* no replacement for the bold tag

HTML's entire job is to give us a way of making annotations about the text, right? When I linked to a previous post above, I was letting the browser know "hey, this text refers to another page". When I used a heading tag ( <h3> ), I was letting the browser know "this is the title of a section". But what does a bold tag say to you?

It could mean a few different things. It might mean "this is the title of a movie", or "this is super super important". Or maybe it means "Kevin really likes using bold text". It doesn't annotate the text. It merely describes the presentation. Just like font choice, or text size, or anything else. That's not a great thing. HTML is for describing the document. Not for making it look pretty.

Imagine if a screen reader were reading the text on this page aloud. Or imagine if this page were printed out in braile. How would you indicate that some text should be "bold"? You can't, really. "Bold" means "use a higher font weight". That has no meaning at all in those contexts. Instead, what we really mean is "this text is strong" or "this text should be emphasized". *How* the browser chooses to represent that isn't really our job. We're supposed to just describe the page to the best of our ability, and let the browser figure out the best way to represent things.

(though if you think *that's* bad, just remember that the marquee tag used to be a thing!)

So HTML doesn't save us

So HTML isn't going to be our saving grace for making this blog look nice. I've been using paragraph (<p>) tags to mark paragraphs, and your browser is more than likely adding the appropriate line spacing there. And we can rely on tags like <strong> to (generally) bold the text, and <em> (short for emphasis) to italicize the text. But for anything super fancy, we need to move beyond mere HTML.

Just remember that HTML's whole job is to help us link and annotate. If we're doing more than that, it's quite possible we're doing too much.

Next time, we'll talk about the absolute worst part of the web. By which, of course, I mean Cascading Style Sheets, or CSS for short. If HTML is the language for describing the content, CSS is the language for describing presentation. And I suppose, begrudgingly, we should spend some time there.

***

←Previous Post | Next Post →