As one the first topics a full stack web developer or web designer learns, Hypertext Markup Language (HTML) is the basis of a website. It is one of the most popular languages to use in the construction of a web page, used by web developers and designers.
In terms of web development job positions, knowing the ins and outs of HTML and what it’s used for is important in a developer interview, particularly if the field is frontend development-focused.
Here are seven of the top HTML interview questions you may come across in a job interview setting and how to best answer them.
1. Tell me about inline elements and compare it to block level elements
Answer: Block level elements force contents to start on a new line. Inline elements do not. As a developer you don’t have control over the height of an inline element – a developer goes with the flow.
Good to hear: Block elements are structural and inline elements are text-based or presentational.
2. What are attributes?
Answer: Attributes occur inside an opening HTML tag to further identify it or give it meaning.
Good to hear: Give an example – i.e. I would give all div tags that have matching styling a class name so I only have to list the Cascading Style Sheets (CSS) is one spot on a style sheet.
3. Why would you use a span tag?
Answer: The span tag is great for when you group elements together that share the same attributes.
Good to hear: Give an example – i.e. I would use a span tag to change the color, the font-size or the font-weight of a word to highlight it in a block of text.
Answer: There are three ways to insert CSS. The first is through the style attribute in any given tag – this is called inline styling. Second, is in a style tag that would be placed in the head of the document as an internal stylesheet. Third, is through an external stylesheet that is linked in the head of the HTML document.
Good to hear: Mention the async and defer attributes in the script tag and how those differ from adding JS without those attributes.
5. Name some ways to make a webpage more accessible.
Answer: Accessibility is one of the most important aspects of creating a web page. We want all of our users to be able to peruse our content. One of the ways we can do this is by using semantic HTML. Semantic HTML tags give the block of code meaning: using
instead of <div>, for instance, definitely describes its use case better.
Using inline elements like
<em> will emphasize text differently in a screen reader than using
Being aware of how the colors we use on our pages may affect clients who are colorblind and taking care to take appropriate action if that needs to change.
Good to hear: ARIA is also a way to make pages more accessible but has largely been replaced by Semantic HTML. With ARIA, the web developer is more responsible for mimicking what Semantic HTML already does.
6. How do you use headings on a webpage?
Answer: There are six levels of headings that can be used on a web page. Typically,
<h1> is used once on a page and assists with SEO. The headings get progressively smaller the higher the number is. The general rule of thumb is to not use a particular heading unless you’ve used the heading that is a priority higher.
Good to hear: You can always go back to higher priority headings. But don’t skip to lower priority headings with using the one that comes before it.
7. What is
<!DOCTYPE html> used for?
Answer: The DOCTYPE indicates which version of HTML you are using.
Good to hear: To use older versions of HTML, you need to add the Document Type Declaration to it.
In addition to these questions, check out Career Karma’s list of interview questions here. With these in your arsenal, you’ll be ready for a development or designer position in no time!
About the author
Christina Kopecky is a writer at Career Karma where she focuses on coding tutorials and technical articles. (LinkedIn)