Block elements and Inline elements

Masum Ahmed
2 min readDec 20, 2020

In this blog , we will try to learn about the often most confused concept of HTML i.e block elements and inline elements and try to differentiate between the two

So what is a block element? Basically a block element can be defined as the element in HTML which consumes the entire full width available on the page and always starts in a new line i.e no two block elements can be on the same line. For example the <div> element is a block-level element.

Some of the block elements in HTML are :

<address>

<article>

<aside>

<blockquote>

<canvas>

<dd>

<div>

<dl>

<dt>

<fieldset>

<figcaption>

<figure>

<footer>

<form>

<h1>-<h6>

<header>

<hr>

<li>

<main>

<nav>

<noscript>

<ol>

<p>

<pre>

<section>

<table>

<tfoot>

<ul>

<video>

Now, what is an inline element? An inline element basically only space required by itself ..so we can say that a single line may contain more than one inline element. An inline element does not start on a new line . For example This is a <span> element inside a paragraph.

<a>

<abbr>

<acronym>

<b>

<bdo>

<big>

<br>

<button>

<cite>

<code>

<dfn>

<em>

<i>

<img>

<input>

<kbd>

<label>

<map>

<object>

<output>

<q>

<samp>

<script>

<select>

<small>

<span>

<strong>

<sub>

<sup>

<textarea>

<time>

<tt>

<var>

To sum up

  • There are two display values: block and inline
  • A block-level element always starts on a new line and takes up the full width available
  • An inline element does not start on a new line and it only takes up as much width as necessary
  • The <div> element is a block-level and is often used as a container for other HTML elements
  • The <span> element is an inline container used to mark up a part of a text, or a part of a document

--

--