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.

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

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.

I want to ask the author if he knows everything 100% in his speciality.

Not everyone who have used HTML should know about the “difference” between DIV and SPAN.There is ABSOLUTELY nothing wrong in not knowing something.Mr.whoeverwrotethis ,are you perfect in everything that you know.You,know how frustrating interviewers of your kind are.Try to allow leverage to the candidates,YOU ARE NO EINSTEIN.

I agree everyone cannot know everything.. but there are certain basic stuff that everyone gotta know.. In web design, you often deal with DIV, SPAN tags almost everyday (especially when you are using external JS libraries to dynamically modify the content).. so, if people never know this, fire them.. that’s the right thing to do for at least 80% of the time.

Anybody can quick reference the w3 and spit out that div = block, span = inline, but whether you know what “inline” and “block” mean is the more important question. But it is unwise to disqualify a candidate on this trivial fact alone, for something that can be picked up on in a matter of a couple of minutes.

Note the emphasis he places on “designer”? He even states it. Since the author expects designers to understand code, the error is his. A designer is someone that designs the look of a site. A good designer has alot of graphic design background and will work within a color scheme, and build a concept site that is essentially just an image. The “developer” will then take that image and develop a site around it. There is no reason why, as the author suggested, a designer would need to know any code at all since it is the developers job to translate the design into a functioning website. To compare, a draftsman might draft a design, but he did not necessarily engineer the design, so if you place an ad for a draftsman and then during phone interviews drill them with engineering questions, you only reveal how foolish you are. The same is true of a designer and developer. Of course amateurs ask for “web builders”, they are clueless.

You misunderstood me. As I wrote in the post, I was trying to hire a web developer, but most of the applicants were more designers than developers. I don’t expect a designer to understand code, or even HTML. I do expect that of a developer, and of anyone who calls themself a developer.

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