The Origin of <div>

Published: Thu 27 July 2017

In Blog.

As I mentioned in a previous post, I'm going through a sort-of programming renewal. I've never had a proper opportunity to get my hands dirty with the language of the web (is “web” even a term that people use anymore?), that is HTML/CSS (and, of course, Javascript, although even considering that one can't deny its firm participation in everything “web” these days, it still hasn't “cracked the nod” as a named participant, at least not to the degree that HTML and CSS have). Doing a quick Google led me to my favourite Oracle, namely StackOverflow and a question seeking “good” sources of information for learning CSS, which further led me to CSS: The Missing Manual.

Book: CSS: The Missing Manual

Gradually, over the years, the style of writing HTML has changed (duh ... I guess)—even I've noticed the shift to copious use of <div> to provide structure in a document when the traditional habit of co-opting semantic HTML tags for purposes other than their original intent started to lose favour.

I guess I didn't try hard enough to dig into the nub of it at the time, but I could never quite understand why the precise purpose of <div> wasn't expanded on—it was just used and there was this tacit understanding that there was universal understanding (if you'll forgive me for indulging in some silly wordplay).

This is the first coherent description by the “Missing Manual” author I've come across:

The <div> and <span> tags have been around for much of the life of the Web. They’ve traditionally been used to organize and group content that doesn’t quite lend itself to other HTML tags. Think of them as like empty vessels that you fill with content.

You might argue that in getting to the bottom of <div> I haven't tried very hard—and you'd be right:

Div tag search on Google

In my defense though, The Programmers Oracle has only been around since 2008, before then, one would have to resort to dodgy sites like expertsexchange to find answers which weren't a patch on SO.

Speaking of SO, following up on answers on that topic will almost always point to the horses mouth:

The div [1] element has no special meaning at all. It represents its children.

That puts pay to that, I guess—it's an element that is just there to attach “other stuff” (that is, CSS “stuff”) to its children. Q: What's all the fuss about? A: There is no fuss. Storm in a teacup. Nothing to see here; move right along.

[1]“div” is short for division

Comments !