July 14, 2024

The Vital Guide to HTML5 Interviewing

The Challenge

Today, HTML is over 20 years old. Over these 20 years, HTML was upgraded 4 times, leaving us with current HTML version 5. The upgrade path was not an easy one: W3C, official maintainer of the HTML specification, was slow in bringing new features to the specification, so web browser developers took things into their hands. This only resulted with more problems, especially for developers that were struggling to create web pages. It caused many cross-browser compatibility issues and wasted development hours. In today’s technology landscape, HTML5 has become an integral part of any front-end development. Although it is not a programming language, it is still an essential component of web applications, and even modern desktop and mobile applications. Today in technology, being 20 years actively used is a very long period. Accordingly, resumes that reference at least some degree of HTML5 experience have essentially become universal in the software development community. This makes locating HTML5 developers fairly easy, but makes pinpointing the perfect one that much more of a challenge.

Old habits die hard. Start using new HTML5 semantic tags today.

Our hiring guide will help you find developers who strive to follow high-quality approaches and have strong knowledge of HTML5 specifications. There’s no magic or foolproof technique, but there are certainly questions you can pose that will help determine the depth and sophistication of a candidate’s knowledge of the language. A brief sampling of such questions are provided below.

Questions and Answers

Q: HTML5 was designed to replace both HTML 4 and XHTML. Discuss new HTML5 features and key goals of the HTML5 specification.

Major goals of the new HTML5 specification were to deliver rich content (like graphics and videos) to customers without the need for additional plugins (namely Flash and Silverlight), to provide better semantic support for web page structure through the introduction of new structural element tags, to provide a stricter parsing standard to simplify error handling, and to simplify backward compatibility with documents written to older standards. In the end, the most important goal in a modern world is to provide better cross-platform support and to ensure that it all works well whether running on desktop computer, laptop, tablet, or even a smartphone.

To achieve all that, many new features were introduced with HTML5. New HTML5 improved support for embedding graphics, audio, and video content via the new <canvas>, <audio>, and <video> tags. Web workers were introduced, new extensions to the JavaScript API such as geolocation were added, new drag-and-drop features, as well as local storage and caching features. Many new semantic tags and new form controls were introduced to complement the structural logic of modern web applications.

Q: Explain what semantic HTML is and name new semantic HTML5 elements.

Semantic HTML is an HTML where the markup, or tags, show the meaning instead of pure presentation or look. For example, HTML5 recommends use of <strong> tags instead of <b> for bold text, and <em>instead of <i> for italic text. These semantic tags will generate the same bold and italic text, but instead of pure formatting information, they provide a meaning too.

HTML5 specification defined whole new semantic elements, like:

  • <article>
  • <aside>
  • <details>
  • <figcaption>
  • <figure>
  • <footer>
  • <header>
  • <main>
  • <mark>
  • <nav>
  • <section>
  • <summary>
  • <time>

New HTML5 form controls include:

  • <calendar>
  • <date>
  • <time>
  • <email>
  • <url>
  • <search>

Q: Discuss potential developer’s pitfalls with HTML5.

Old habits die hard. Many developers write modern web applications in HTML5 by using old specifications. The most prominent examples are when developers use <table> tag to setup a layout, or <span> or <div>when new semantic tags like <header>, <footer>, <article> or <aside> tags would be more appropriate. Or as discussed before, they don’t use new semantic tags <strong> or <em> instead of <b> and <i> tags. The result of this old approach is over-complicated markup that is behaving inconsistently across different browsers. When writing new HTML5 documents, developers should adopt new semantic tags, enjoy all the benefits that come with HTML5 specification, and let the old habits live in the past.

Q: Discuss how new HTML5 elements could be used in different combinations, namely <header> and <footer>, and <section> and <article>.

New HTML5 elements opened up a whole new combination of possibilities and interesting ways of their usage.

For example, despite classic knowledge that there can only be one header and only one footer, new HTML5 document can contain multiple <header> and <footer> elements. Both the new semantic tags are designed to serve their respective purposes in relation to their parent element. This means that not only the page <body> can contain a header and a footer, but so can every <article> and <section> element.

Another example is usage of new <section> and <article> elements, and their combination: <section>can contain <article> elements, and an <article> can contain <section> elements. To describe this with an example: in your web page you could have a dashboard page with a <section> for social network interactions, and a <section> for the latest news articles which would contain several <article> elements. Conversely, an <article> might contain a <section> at the end for reader comments.

Q: Discuss how HTML5 simplified HTML structure. Provide examples.

For a start, HTML5 specification simplified doctype declaration. Doctype, or Document Type Declaration, tells the browser what type of document they can expect. The old XHTML doctype declaration was as follows:

<span class="hljs-doctype"><!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

While HTML4 Transitional doctype looks like this:

<span class="hljs-doctype"><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

The new doctype declaration for HTML5 is very simple:

<span class="hljs-doctype"><!DOCTYPE html></span>

Another simplification that HTML5 introduced, is how we declare character encoding, or charset, of the document. The charset declaration in HTML5 is as follows:

<!DOCTYPE html>
    <meta charset=<span class="hljs-string">"UTF-8"</span>>
    <span class="hljs-keyword">...</span>
    <span class="hljs-keyword">...</span>

This is much simpler than previously in HTML4 which didn’t have charset meta attribute:

<!DOCTYPE HTML PUBLIC <span class="hljs-string">"-//W3C//DTD HTML 4.01 Transitional//EN"</span>
   <span class="hljs-string">"http://www.w3.org/TR/html4/loose.dtd"</span>>
    <meta http-equiv=<span class="hljs-string">"Content-Type"</span> content=<span class="hljs-string">"text/html; charset=utf-8"</span>>
    <span class="hljs-keyword">...</span>
    <span class="hljs-keyword">...</span>

HTML5 specification went so far in the simplification, that the tags <html>, <body> and <head> are not mandatory for an HTML5 document to be valid. Following simple example will pass W3C Markup Validation Service:

<span class="hljs-doctype"><!DOCTYPE html></span>
<span class="hljs-tag"><<span class="hljs-title">title</span>></span>My title<span class="hljs-tag"></<span class="hljs-title">title</span>></span>
<span class="hljs-tag"><<span class="hljs-title">header</span>></span>My header<span class="hljs-tag"></<span class="hljs-title">header</span>></span>
<span class="hljs-tag"><<span class="hljs-title">p</span>></span>Wall of text<span class="hljs-tag"></<span class="hljs-title">p</span>></span>

The only important tag in this example to work is the new doctype for HTML5, without it the browser will not be able to detect that it is an HTML5 document.

Q: Explain why a cross-browser support is still important if all the modern browsers follow the same HTML5 specification.

HTML5 specifications is a set of rules that defines a valid document, and also provides instructions on how browsers must interpret and render such a document. Unfortunately, the reality is that no browser still supports all the rules defined by HTML5 specification. Most of the major browsers are supporting most of the specification, but there are still differences in browser interpretation of HTML5 specifications. As a result, it is necessary for the developer to confirm whether the aspect they are making use of will be supported by all of the browsers on which they hope to display their content. This is why cross-browser support continues to be a headache for developers, despite the improved specifications.

Q: Discuss accessibility aspects of HTML5, especially its limitations and problems when used in real world.

Today, web pages and applications are used more and more, and making them accessible to people who rely upon assistive technology is becoming more important than before. HTML has gone a long way, and HTML5 introduced new user interface features which enable people who rely upon assistive technology to use the web more easily. Although, there are problems. One of the problems is that developers and designers previously didn’t pay too much attention to this aspect of their web pages or applications. In their defense, as mentioned, one of their main reasons was that the web prior HTML5 didn’t have any accessibility interface features. And now, even if developers want to implement additional accessibility options in their applications, there is a constant problem any new and emerging web technology is facing: browser support. HTML5 accessibility is keeping track of the most common accessibility features across browser. To implement accessibility features and to cover all the browsers, additional time investment is required from developers. This can be a key factor that clients need to anticipate if they want their web applications and pages to be on the edge of what is possible with technology today.

Q: Explain HTML5 Web Storage, discuss its security considerations, and the difference between localStorage and sessionStorage.

HTML5 enabled web pages to store data locally within the user’s browser with use of Web Storage. In earlier versions, developers could only use cookies. New Web Storage is more secure and faster. Unlike cookies, data from Web Storage is not included with every server request, it is used only when asked for. The data is stored as a name and value pairs. Other benefits over cookies is storage limit. Web storage can be up to 5MB big, and its content is never transferred to the server. A web page can only access data stored by itself because it is limited per origin.

It is important to note that while Web Storage is more secure than cookies, there are things to keep in mind. It is better than using cookies because the content is not transmitted over the wire, but local storage is not encrypted. For that reason, sensitive data like security tokens should never be stored there. Web application should never rely on data stored in Web Storage, as a malicious user can easily modify data in the localStorage and sessionStorage values at any time.

Speaking of sessionStorage, the difference between localStorage and sessionStorage involves the lifetime and scope of the storage. Data stored through localStorage is permanent: it does not expire and remains stored on the user’s computer until a web application deletes it, or the user asks the browser to delete it. On the other hand, sessionStorage has the same lifetime as the browser tab in which the script that stored it is running. When the tab is closed, any data stored through sessionStorage is deleted.

Unlike the origin limit of the localStorage, sessionStorage is window scoped. For example, if a user has two browser tabs displaying documents from the same origin, those two tabs have separate sessionStoragedata. The scripts running in one tab cannot read or overwrite the data written by scripts in the other tab, even if both tabs are visiting exactly the same page and are running exactly the same scripts.

Q: Explain what web workers are.

JavaScript is a single-threaded language, so multiple scripts cannot run at the same time. Web workers is a new API for running scripts in the browser background independently of other scripts, in its own thread. The result is that web pages don’t need to wait for web workers to complete, which improves performance and responsiveness, because users can interact with the page while the web worker is still running in the background. Web workers are, for example, perfect for long-running scripts that do heavy computation.

Wrap Up

We just scratched the surface of the knowledge needed to be a top HTML5 developer. Finding true masters of HTML5 is a challenge. We hope you find the questions presented in this post to be a useful foundation in your quest for the elite few among HTML5 developers. Finding such candidates is well worth the effort, as they will undoubtedly have a significant positive impact on your team’s productivity and results.


Tomislav is a lead software engineer and entrepreneur with extensive experience in design and development of web, mobile, and desktop applications. He has an excellent knowledge of various geospatial technologies, and great passion for maps and visualizations. He is flexible and able to integrate as a standalone freelancer or within teams. Hire TOMISLAV

Leave a Reply

Your email address will not be published. Required fields are marked *