Inline vs. Block Elements + Divs

Understanding how HTML Elements are Rendered in the Browser

Inline vs. block-level elements

Each HTML element is interpreted in a specific way by your web browser. In this lesson, we will discuss block-level and inline HTML elements to gain a better understanding of how content is rendered.

Block-level elements

Block-level HTML elements take up the full width of a web page, essentially creating a “block” around the content you place within that element. Block-level elements, by default, also start on a new line. The following are some of the block-level elements:

  • Headings (<h1>-<h6>)
  • Ordered and Unordered Lists (<ol>, <ul>)
  • List Items (<li>)
  • Paragraphs (<p>)

Inline elements

Inline elements, like the name suggests, do not take up the full width of a webpage and are generally in-line with text content. Inline elements also do not start a new line when rendered in the browser. Examples of inline elements include:

  • Anchors (<a>)
  • Images (<img>)
  • Bolding Text (<strong>)
  • Emphasizing Text (<em>)

The coding example below helps illustrate the differences between block-level and inline HTML elements:

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy