HTML Formatting Interview Questions & Answers (2025)

Congratulations on completing the second chapter! You now have the skills to add and format all the core content of a webpage. Let's review the key concepts to prepare you for real-world interview questions.

Chapter 02 Summary

  • Headings (<h1>-<h6>): Create a logical document outline for SEO and accessibility.

  • Paragraphs (<p>): The standard element for all blocks of text.

  • Semantic Tags (<strong><em>): Add meaning (importance/emphasis) to text.

  • Links (<a>): Use the href attribute to connect pages.

  • Images (<img>): Require src and descriptive alt attributes.

Common Interview Questions & Answers

Question 1: Why should you only use one <h1> per page?

  • Impressive Answer: The <h1> element represents the primary topic of the page's content and is a major signal for the document's outline. Using a single <h1> creates a clear and unambiguous structure for both search engine crawlers, which heavily weigh its content, and for assistive technologies like screen readers, which rely on a clean heading hierarchy for user navigation.

Question 2: What is the purpose of the alt attribute on an <img> tag, and why is it important?

  • Impressive Answer: The alt attribute provides essential alternative text for an image. It has two critical functions: first, for accessibility, it is read aloud by screen readers to describe the image to visually impaired users. Second, for SEO, it provides context to search engines, enabling them to index the image for image search. It's a fundamental part of a well-built, accessible, and optimized webpage.

Question 3: An interviewer asks, "When would you use the <b> tag over the <strong> tag?"

  • Impressive Answer: The choice is based on semantics, not appearance. You should use <strong> when the content has strong importance or seriousness, as this meaning can be conveyed by assistive technologies. You would use <b> purely for presentation, to draw a reader's eye to text that has no added importance, such as a product name or a keyword. Essentially, <strong> is for meaning, while <b> is for style.

What's Next: You've mastered content! But what about organizing it into more complex structures? In our next chapter, "03 - Organizing Information: Lists & Tables," we'll learn how to handle lists of items and display data in a clean, tabular format.

Posted in 02 - Core Content & Text Formatting and tagged , , .