The eclectic musings of a bitter software engineer.

The difference between a div and a span

Monday July 31, 2006 @ 01:12 PM (PDT)

I've interviewed what seems like an endless stream of web designers (emphasis on designers) over the last month or two, and they all seem to have one thing in common: they don't know what the hell they're talking about.

One of the technical questions I always ask and nobody ever answers correctly is, "What is the difference between a div and a span?"

Invariably, each candidate launches into a nervous, stuttering, uncertain description of how they use divs for certain things and spans for other things. When I ask why they use them for different things, the answer is always something along the lines of, "Um...I don't really know."

I had no idea that the level of basic HTML knowledge among people calling themselves web designers (and especially those calling themselves web developers, which is the position we're interviewing for) is so low. This is absolutely shocking to me. Some of the people I've interviewed have done very high-profile websites and have excellent design skills. The fact that they claim to know HTML without understanding this fundamental concept is surprising, absurd, and above all frustrating.

The difference between a div and a span is very simple. The HTML 4 specification has this to say on the subject (emphasis added):

The DIV and SPAN elements, in conjunction with the id and class attributes, offer a generic mechanism for adding structure to documents. These elements define content to be inline (SPAN) or block-level (DIV) but impose no other presentational idioms on the content. Thus, authors may use these elements in conjunction with style sheets, the lang attribute, etc., to tailor HTML to their own needs and tastes.
http://www.w3.org/TR/html401/struct/global.html#h-7.5.4

That's it. That's the answer. All I'm looking for are the words "inline" and "block-level". If you say those words in the correct order, you pass the test. A++++++, would hire again.

Of course, this is only one of the five or so technical questions that every candidate gets horribly wrong. Next time I'll write about the differences between absolute, relative, fixed, and static positioning in CSS.

Update: About an hour after posting this I interviewed another candidate over the phone and he aced all my questions. First time that's ever happened. I should have blogged about this sooner.

Comments

he probably had w3.org and google on the other end of the phone.

Tuesday August 01, 2006 @ 01:52 AM (PDT) Posted by someguy

Nothing wrong with that.

Tuesday August 01, 2006 @ 09:11 AM (PDT) Posted by Ryan Grove

Dang it, I could have passed that test! Still, it's more important they know the difference between an id and a class, hehe.

Friday August 04, 2006 @ 03:53 PM (PDT) Posted by NC

After I read this post a week ago I thought about inquiring for a position. I've been doing the self-employed thing for a while, and I just started up some low maintenance ventures. Having a real paid job would be nice, and I'd probably want to move closer to the area. I don't have a resume prepared, but I think I could pass your test.

Thursday August 10, 2006 @ 02:54 AM (PDT) Posted by Travis Pulley
Post a comment

Basic XHTML (including links) is allowed, just don't try anything fishy. Your comment will be auto-formatted unless you use your own <p> tags for formatting. You're also welcome to use Textile.

Don't type anything here unless you're an evil robot:


And especially don't type anything here:

Copyright © 2002-2008 Ryan Grove. All rights reserved.
Powered by Thoth.