Web Developer Interview Questions

Web Developer Interview Questions:

The main technologies required for a web developer are CSS, HTML and JavaScript. A good web developer also needs to have a grasp of and interest in both web standards and accessibility. While most web developer roles require other technologies such as Unix, Apache and server management, MySQL & PHP or SQL & ColdFusion or other dB and programming technologies, CVS, Perforce, or other source control management interfaces, I am only going to cover the technologies that span all Web Developer job descriptions: HTML, Web Standards and Accessibility, CSS and JavaScript.

The main skill I look for in a web developer is intelligence*, a desire to learn and an adoration of web standards. These questions target knowledge rather than capacity to learn. So, for each question remove 2 points if the answer, whether correct or not, sounded like it was quoted from a text book or this blog entry (unless, of course, you are interviewing me). Add points for interviewee efficient thought processes: if they didn’t know the answer to start with but figured it out in the end.

Please have a look at Web Developer Resume Screening for thought on how to filter through resumes to find good Web Developer applicants.

* Note: Intelligence ≠Education. A Masters or PhD may just mean that they had the time and money to delay getting a job. Look for people who can think, not ones who regurgitate text books.

Please note that these questions are two years old.
… and … quoting @seldo: “I am adding ‘Can you use the men’s room without peeing all over the floor?’ to my list of phone screen interview questions.” Generally not necessary if interviewing women.

XHTML, CSS & JavaScript Web Developer Applicant Questions

XHTML Web Standards Interview Question


What is a DTD? What DTD do you generally use? Why? Pros and cons.


See the bottom half of DTD: the Document Type Declaration

Answer Rating:

  1. Completely wrong answer though pretends to know it
  2. I don’t know (I give points for honesty), trying unsuccessfully but honestly to give the right answer
  3. Knowledge of the definition, but doesn’t know why they are used.
  4. Knowledge of which one to use and why
  5. Explanation of Quirks mode versus Regular mode and analysis of which one is best for different media

Accessibility Interview Question


Tell me some considerations in selecting font size?


Font sizes should be declared using relative measurement values, such as ems, via a style sheet, without the use of the term !important. There are issues with browser font size enlarging which can be rectified via CSS.

Answer Rating

  1. uses <font> tag
  2. Gives an answer using pixels using CSS
  3. Explains that font size should be declared using relative font sizes
  4. Explains that font size should be declared using ems or percentages
  5. Gives the answer above

CSS Interview Question


a) What are the possible values for the display attribute that are supported by all browsers?
b) What is the default value for the display attribute for the image element? (what is the difference between inline and block level elements)
c)What does display: run-in do?
d) Difference between “visibility:hidden” and “display:none”? What are the pros and cons of using display:none?


main values: none, block, inline, list-item, run-in
all values: inline | block | list-item | run-in | compact | marker | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | none | inherit
default value: inline, block or list-item, depending on the element. The <img> is an inline element.
Run-in should make the run-in element be the first line of the next sibling block level element, if it is before a block level element that is not floated or absolutely positioned. If the next sibling is positioned or floated, then the run-in element will be a block level element instead of appearing in-line.
PPK’s Quirksmode explains it well. The w3schools lists table display values.
When visibility is set to hidden, the element being hidden still occupies its same place in the layout of the page. If the display is set to none, the element does not occupy any space on the page — as if it didn’t exist..

Answer Rating

  1. Doesn’t know
  2. Knows the answer to A
  3. Knows the answer to A and D
  4. Knows the answer to A, B and D
  5. Knows the answer to C too!

CSS Interview Question


a) What are the five possible values for “position”?
b) What is the default/initial value for “position”?
c) How does the browser determine where to place positioned elements
d) What are the pros and cons of using absolute positioning?
e) if they are really advanced, ask about IE z-index issues with positioned elements.


a) Values for position: static, relative, absolute, fixed, inherit
b) Static
c) They are placed relative to the next parent element that has absolute or relative value declared
d) Absolutely positioned elements are removed from the document flow. The positioned element does not flow around the content of other elements, nor does their content flow around the positioned element. An absolutely positioned element may overlap other elements, or be overlapped by them.
e) IE treats a position like a z-index reset, so you have to declare position of static on the parent element containing the z-indexed elements to have them responsd to z-index correctly.

Answer Rating

  1. Doesn’t know
  2. Knows 4 out of 5 answers in part A
  3. Knows A & B
  4. Knows A, B & C
  5. Knows A-D
  6. Knows E too

CSS Interview Question


Write a snippet of CSS that will display a paragraph in blue in older browsers, red in newer browsers, green in IE6 and black in IE7

Possible Answer:

#content p{color:blue}
html>body #content p {color:red}
* html #content p{color:green}
html>body #content p {*color:black;}

Answer Rating

  1. Doesn’t know
  2. Knows how to declare one color, but no hacks
  3. knows the html>body hack and * html hack
  4. Knows all the hacks, but doesn’t validate or uses conditional comments in the HTML
  5. Gives you the right answer and explains why the CSS won’t validate, or, uses a valid hack, other than conditional IE comments, instead of the above answer.

Basic Javascript Interview Question


What is the correct way to include JavaScript into your HTML?


See Including Javascript in XHTML for answers.

Answer Rating:

  1. <a href=”javscript:function()”> – and other incorrect answers
  2. verbally explains the theory but doesn’t know how to do it
  3. correct explanation using inline event handlers or inline code
  4. discusses and knows how to implement javascript event listeners
  5. Explainst how you include JS within an XHTML document and ensure it validates using CDATA, explains

Basic Javascript Array / XHTML Form Interview Question


Are the following all equal, and, if so, what would your code look like to make the following all equal the same thing:



<form name="myform" method="post" action="something">
<input name="anything" value="anything" type="something" />
<input name="field" value="something" type="something" />

Answer includes knowing that the form is the second form on the page, and that the field input element is the second element within that form.

Answer Rating

  1. Doesn’t know how to code forms and doesn’t know that the first index of an array is 0.
  2. Knows either how to code forms with valid XHTML or that array starts at 0, but not both.
  3. Knows how to code forms but not correctly, but omits something like doesn’t know that the form needs to be the second one on the page, and the element is the second one in the form. Would know how to do it if they actually put thought into it.
  4. Codes the form correctly, but uses ID instead of name
  5. Codes everything correctly

JavaScript Interview Question


How do you dynamically add a paragraph with stylized content to a page?

Possible Answer:

newParagraph = document.createElement('p');
newParagraph.setAttribute('class', 'myClass');
newText = document.createTextNode('this is a new paragraph');
myLocation = document.getElementById('parent_of_new_paragraph);

Answer Rating:

  1. Wrong Answer (i.e. “you can’t”), I don’t know.
  2. Use JavaScript, with no knowledge or incomplete knowledge of how that is done. Suggesting innerHTML, but not really knowing. Or explanation of accessibilty issues surrounding this.
  3. Able to explain how you create a node, add content to the node, add a class attributes to that element, and then add that node as a child of the parent element (the above example)
  4. Explanation of how to do it (worth 3 points) and explanation as to issues that arise when doing it, such as screen readers not knowing that text has changed, IE6 and IE7 not applying styles included with added content, not duplicating IDs, etc.
  5. Has no clue how to do it to start, but can figure it out with guidance: extra points for the quick learner!

Other questions ideas:

Q: How do you organize your CSS? How do you come up with id and class names (what naming conventions do you use)?
A: While there are no right answers, there are best practices. Issues to look for are not having div mania, no inline CSS, no presentational markup, minimal use of classes, understanding the CSS cascade.

Q: What do you think of hacks? When should you use them? If you use them, how do you maintain them? What can be done to avoid needing to use box-model hacks? (if they aren’t pros, you can ask them what is the issue with x-browsers and the box model)

Q: What are the pros and cons of using tables for layout? Do you use tables? What are the pros and cons of tableless design? How do you generally layout your pages?
A: check for them NOT using tables

Q: Check to ensure that they separate structure and semantics first from presentation later? Do not ask about this during HTML, but do in webstandards.

Q: What are some deprecated elements and attributes that you use, and in what instances do you use them?
A: List of deprecated elements and attributes.

Q: What is involved in making a website accessible? What are arguments you use to convince others to invest in making their web site accessible.
A: See Making the web Accessible. Making sites accessible also makes them more search engine friendly (saves money), makes your pages accessible to the 20% of the population that has some type of disability (so you can make more money) and it’s the law in many places.

Q: Define what web standards mean to you? How do you implement web standards?

Q: In CSS, how can you make a form elments background-color change when the user is entering text? will this work in all browsers?

Q: How can you target an element in your HTML using the DOM?

This entry was posted in Web Development. Bookmark the permalink.

15 Responses to Web Developer Interview Questions

  1. Chad says:

    Excellent interview guide that I will use the next time I’m an interviewer or interviewee. One note on your form question, wouldn’t the solution include a form prior to the form listed? The DOM reference to document.forms[1] would not work unless there was a preceding form.

  2. Kim says:

    Why couldn’t you have posted this two weeks ago? 😉

  3. Robert says:

    wow what a difficult questions, if I was being interviewed, surely I will have a bad score. I don’t understand well, so we really need to use hacks or use conditional IE comments?

  4. Dave G. says:

    Thanks for the great questions. These will be helping me to find another Designer for our team. These are definately good to evaluate, not only their skillset but their passion for front end development.
    I used a few of your interview questions in the interviews I have had lately.

  5. Dave G. says:

    In reply to Robert.
    Conditional comments are what we shoot for in most cases. Conditional comments only work for internet explorer versions. Hacks tend to make a mess of code.
    The only issue is that you are adding another file to grab which slightly degrades performance. I would still tend to go with conditional comments for the fact that only IE pays the price for the hacks. (hacks within your regular css code gets downloaded by ALL browsers)
    So this is a bit of a benefit especially if your hacks for IE are many.

  6. Estelle says:

    @chad: In the answer to the forms[1] question it does say that it has to be the second form on the page. “Answer includes knowing that the form is the second form on the page, and that the field input element is the second element within that form.”

    @David: you can use conditional comments to exclude internet explorer too.

    <!-–[if !IE]><!-–>
    Code omitted from Internet Explorer

  7. jonah says:

    good questions but nobody knows what position: run-in is!

  8. Pingback: Confluence: Department - IT

  9. Pingback: Confluence: Developer

  10. Anton says:

    “A Masters or PhD may just mean that they had the time and money to delay getting a job. Look for people who can think, not ones who regurgitate text books.”

    Ignorant comment. Clearly you have little idea of what is required to successfully complete a PhD (and to a somewhat lesser extent, a Masters degree).

  11. Wesley says:

    “Ignorant comment. Clearly you have little idea of what is required to successfully complete a PhD (and to a somewhat lesser extent, a Masters degree).”

    Anton, to say that this was an ignorant comment implies that you believe the comment is not true. How can you disagree so strongly with a comment that is not dogmatic? The statement “…may just mean…” is critical in sense that the author is not stating their opinion as 100% fact, yet as a mere possibility within a given scenario. And to say that you disagree with a possibility in this instance only shows your ignorance.

    People will respect a well thought rebuttal, but they will run from unfounded emotional reactions such as this.

  12. Kostya says:

    Not impressed.
    Some questions are outright incorrect, some answers are just wrong.

    What is the definition of “old” browsers in q.5?
    What is the definition of “all” browsers in q.3?
    What kind of sense does it make to ask about a css property not supported by any browser (well, almost any)?

    and “.question {border-bottom: 1px dashed #ccc; margin:0; padding:1em;} .question p {margin:0 0 1em 0; padding:0;} .question p.h {margin:1em 0 0 0; padding:0; font-weight:bold;} .question ol {margin-top:0; list-style-type:decimal;}” at the top of the page — is it a glitch?

    btw, your comments boxes (even ones) borders are broken

  13. Christina says:

    These questions are absolutely ridiculous. You’d never be able to hire anyone because no one would be able to answer these outrageous questions “correctly”!

  14. dean cameron says:

    i was quizzed with many of these questions yesterday.

    thanks for nuthin’

  15. Estelle Weyl says:

    Kostya – for “old” versus “new” browsers. I didn’t want this post to outdate itself immediately. Yahoo keeps a list of what they call “Grade-A” browsers at http://developer.yahoo.com/yui/articles/gbs/

    Thanks for the feedback.