logo

modern front end tech

block and inline elements

In this chapter you are going to learn:-

What is Block Element?

A block-level element is an HTML element that starts on a new line and takes up the full width available, stretching out to the left and right as far as it can. Block-level elements typically contain other block-level elements or inline elements. Examples of block-level elements include:

Examples of Block Elements

Here are some common examples of block-level elements in HTML:

What is Inline Element?

An inline element is an HTML element that does not start on a new line and only takes up as much width as necessary. Inline elements are typically used for formatting small parts of text or grouping small elements together within a block-level element. Examples of inline elements include:

Examples of Inline Elements

Here are some common examples of inline elements in HTML:

Difference between div and span

The main difference between <div> and <span> is that <div> is a block-level element, while <span> is an inline element and div is container for block-level content whereas <span> is container for inline content. <div> is used to group larger sections of content, while <span> is used to group smaller pieces of content within a line.

our youtube channel