Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 1

HTML5 Semantics and Display Types

Recommended resources

Hello! Welcome to your intensive revision course. We're kicking things off with a foundational review of frontend web technologies, which are a frequent focus in the written QCM exam. Even with your professional experience, the exam tests for very specific, academic knowledge of these fundamentals, so a precise review is key to building both your skills and your confidence.

In this first lesson, we will focus on two core HTML and CSS concepts. First, we'll solidify your understanding of HTML5 semantic elements—what they are and, more importantly, why and when to use them over a generic <div>. Second, we'll dissect the CSS display property, distinguishing precisely between the block, inline, and inline-block behaviors. Mastering these distinctions is crucial, as they are a common source of multiple-choice questions.

The Meaning Behind the Markup: Semantic HTML

In modern web development, how you structure your document is as important as how it looks. Using tags that describe the meaning of your content—known as semantic HTML—is fundamental. This practice isn't just academic; it has direct implications for search engine optimization (SEO), accessibility for users with screen readers, and code maintainability.

Consider the following comparison:

This image directly contrasts a page structure built with semantic elements like `<header>` and `<article>` against one using only `<div>` tags with IDs and classes. Both can be styled to look identical, but the semantic version provides clear, machine-readable context.

This image directly contrasts a page structure built with semantic elements like <header> and <article> against one using only <div> tags with IDs and classes. Both can be styled to look identical, but the semantic version provides clear, machine-readable context.

The code on the left is inherently more descriptive. A browser, a search engine, or an assistive device immediately understands the role of each part of the page. The code on the right relies entirely on class or id names for human readability, offering no built-in meaning.

To understand why this is so critical and which elements to use, the following video provides a concise and practical overview.

Why & When to Use Semantic HTML Elements over Divs

Watch this video from ByteGrad to understand the three main benefits of using semantic tags. Pay close attention to the basic page structure presented.

Watch the first two sections of the video, covering the "why" and the basic structure of a page using <header>, <main>, and <footer>. Focus on the explanations for the three main reasons for using semantic tags and the overview of the basic page layout elements.

Now that you have a high-level view, let's dive into the specifics. The following article provides an excellent, modern breakdown of the essential semantic tags you need to know for your exam.

Semantic HTML in 2025: The Bedrock of Accessible, SEO- ...

This reading will give you a comprehensive list of the core semantic elements and their intended purposes, which is exactly the kind of knowledge tested in QCMs. The final cheatsheet is an excellent resource for quick revision.

Please read two parts of the article "Semantic HTML in 2025". First, review the tables in the section titled Core Semantic Elements. These tables categorize elements by function (Layout, Content, Interactive), which is a helpful way to organize them in your mind. Next, jump to the end of the article and study the Bonus Cheatsheet. The "Semantic vs Non-Semantic Tags" table is particularly high-yield for exam preparation, as it directly contrasts correct usage against common anti-patterns.


Controlling Layout Behavior: The display Property

After defining the meaning of our content with semantic tags, the next step is to control how they are positioned and how they interact within the page layout. The CSS display property is the primary tool for this. Most HTML elements have a default display value, usually block or inline. Understanding the exact behavior of these values—and the hybrid inline-block—is critical.

The following video offers a very detailed and clear explanation, highlighting the nuances that often appear in technical questions.

CSS Display Property: Block, Inline & Inline-Block - The Most Detailed Explanation on YouTube!

This video from Future Fullstack provides one of the most thorough explanations of the CSS display property. It will clarify exactly how width, height, margin, and padding behave differently for each display type.

Please watch the following segments carefully: Recap: Begin with the quick refresh on block and inline elements to set the stage. Inline's Weirdness: Watch the detailed explanation of how box model properties apply to inline elements. This is a key section, as the counter-intuitive behavior (e.g., vertical padding not pushing other elements) is a classic exam topic. The inline-block Solution: Next, watch the segment that explains how inline-block combines features of both block and inline elements. Demonstration: Finally, see the practical demonstration of changing an element's display value from inline to block and then to inline-block. This will visually solidify the concepts.

To consolidate this information, here is a clear summary table that contrasts the behaviors of inline, inline-block, and block. This is a perfect reference to review before the exam.

This table summarizes the key differences between `inline`, `inline-block`, and `block` elements regarding line breaks, dimensions, and spacing. Note how `inline-block` acts as a hybrid of the other two.

This table summarizes the key differences between inline, inline-block, and block elements regarding line breaks, dimensions, and spacing. Note how inline-block acts as a hybrid of the other two.

Let's put this into practice with a textual resource that lays out these rules clearly.

CSS Display Property Guide: block, inline, inline-block

This guide provides a concise written explanation of each display type, reinforcing what you saw in the video. Reading through the examples will help you internalize the rules.

Read the sections explaining display: block, display: inline, and display: inline-block. Start with the section on Display: block to review its characteristics. Then, read about Display: inline, paying close attention to the limitations regarding width, height, and vertical margins. Finally, read the section on Display: inline-block to see how it solves the limitations of inline.


Key Takeaways

This lesson covered the foundational concepts of structuring a web page semantically and controlling element layout behavior. For your QCM exam, remember these key distinctions:

  • Semantic vs. Non-Semantic: Always prefer a semantic tag (<nav>, <article>, <section>) over a generic <div> when the tag accurately describes the content's purpose. This improves accessibility, SEO, and maintainability.
  • display: block: Starts on a new line, takes up the full available width of its container by default, and respects all box model properties (width, height, margin, padding). Examples: <div>, <p>, <header>, <li>.
  • display: inline: Sits on the same line as adjacent content, only takes up as much width as its content needs, and ignores width, height, and vertical margin. Horizontal margin and padding work, but vertical padding will overlap other elements without pushing them away. Examples: <span>, <a>, <strong>.
  • display: inline-block: The hybrid. Sits on the same line (inline behavior) but respects all box model properties, including width, height, and vertical margin/padding (block behavior). This is commonly used for navigation items or buttons that need to be side-by-side but have specific dimensions.

Next Steps

In our next lesson, we will continue our review of CSS fundamentals by diving into CSS selector specificity and the box model. Now that you understand how elements are displayed, you'll learn the rules that determine which styles apply when there are conflicts and how to precisely control an element's size and spacing.